復制代碼 代碼如下:
''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
''SendEmail
NameSpace = "http://schemas.microsoft.com/cdo/configuration/"
Set Email = CreateObject("CDO.Message")
Email.From = "發(fā)送郵箱"
Email.To = "接收郵箱"
Email.Subject = "主題"
Email.Textbody = ssdate() 'ss為獲取到的ip
'Email.AddAttachment "附件的路徑例如:C:\foo.zip"
With Email.Configuration.Fields
.Item(NameSpace"sendusing") = 2
.Item(NameSpace"smtpserver") = "smtp.163.com" 'smtp服務器地址
.Item(NameSpace"smtpserverport") = 25
.Item(NameSpace"smtpauthenticate") = 1
.Item(NameSpace"sendusername") = "賬戶名,發(fā)送郵箱的"
.Item(NameSpace"sendpassword") = "密碼"
.Update
End With
Email.Send
注意代碼中的參數(shù)設置。
您可能感興趣的文章:- C# 郵箱mail 發(fā)送類
- c#調用qq郵箱smtp發(fā)送郵件修改版代碼分享
- Java基于JavaMail實現(xiàn)向QQ郵箱發(fā)送郵件
- Python實現(xiàn)給qq郵箱發(fā)送郵件的方法
- 使用vbs獲得外網(wǎng)ip并發(fā)送到郵箱里
- VBS獲取外網(wǎng)IP地址并發(fā)送到指定郵箱的代碼
- 在Laravel框架里實現(xiàn)發(fā)送郵件實例(郵箱驗證)
- java實現(xiàn)163郵箱發(fā)送郵件到qq郵箱成功案例
- C#發(fā)送郵箱實現(xiàn)代碼
- 局域網(wǎng)電腦獲取外網(wǎng)IP發(fā)送到指定郵箱工具