复制代码 代码如下:
''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 = "发送邮箱"
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") = "账户名,发送邮箱的"
.Item(NameSpace"sendpassword") = "密码"
.Update
End With
Email.Send
注意代码中的参数设置。
您可能感兴趣的文章:- C# 邮箱mail 发送类
- c#调用qq邮箱smtp发送邮件修改版代码分享
- Java基于JavaMail实现向QQ邮箱发送邮件
- Python实现给qq邮箱发送邮件的方法
- 使用vbs获得外网ip并发送到邮箱里
- VBS获取外网IP地址并发送到指定邮箱的代码
- 在Laravel框架里实现发送邮件实例(邮箱验证)
- java实现163邮箱发送邮件到qq邮箱成功案例
- C#发送邮箱实现代码
- 局域网电脑获取外网IP发送到指定邮箱工具