Home > Web Front-end > JS Tutorial > body text

Get the external network IP and send the vbs code to the specified mailbox

高洛峰
Release: 2017-01-16 09:41:00
Original
1599 people have browsed it

''getIP 
set http=createobject("Microsoft.XMLHTTP") 
ipp="http://www.ip138.com/ip2city.asp" 
http.open "get",ipp,false 
http.send 
ss=bytes2BSTR(Http.responsebody) 
intStrA = InStr(1,ss,"[",1)+1 
sss=mid(ss,intStrA) 
intStrB = InStr(1,sss,"]",1)-1 
ss=mid(ss,intStrA,intStrB) 
'wscript.echo ss 

Function bytes2BSTR(vIn) 
strReturn = "" 
For i = 1 To LenB(vIn) 
ThisCharCode = AscB(MidB(vIn,i,1)) 
If ThisCharCode < &H80 Then 
strReturn = strReturn & Chr(ThisCharCode) 
Else 
NextCharCode = AscB(MidB(vIn,i+1,1)) 
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode)) 
i = i + 1 
End If 
Next 
bytes2BSTR = strReturn 
End Function 

&#39;&#39;SendEmail 
NameSpace = "http://schemas.microsoft.com/cdo/configuration/" 
Set Email = CreateObject("CDO.Message") 
Email.From = "发送邮箱" 
Email.To = "接收邮箱" 
Email.Subject = "主题" 
Email.Textbody = ss&date() &#39;ss为获取到的ip 
&#39;Email.AddAttachment "附件的路径例如:C:\foo.zip" 
With Email.Configuration.Fields 
.Item(NameSpace&"sendusing") = 2 
.Item(NameSpace&"smtpserver") = "smtp.163.com" &#39;smtp服务器地址 
.Item(NameSpace&"smtpserverport") = 25 
.Item(NameSpace&"smtpauthenticate") = 1 
.Item(NameSpace&"sendusername") = "账户名,发送邮箱的" 
.Item(NameSpace&"sendpassword") = "密码" 
.Update 
End With 
Email.Send
Copy after login

Pay attention to the parameter settings in the code.

For more articles related to vbs code that obtains the external network IP and sends it to the specified mailbox, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template