雷火电竞-中国电竞赛事及体育赛事平台

歡迎來(lái)到入門教程網(wǎng)!

vb

當(dāng)前位置:主頁(yè) > 軟件編程 > vb >

獲取外網(wǎng)IP并發(fā)送到指定郵箱的vbs代碼[已測(cè)]

來(lái)源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:vb|點(diǎn)擊:

復(fù)制代碼 代碼如下:

''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 = ss&date() 'ss為獲取到的ip 
'Email.AddAttachment "附件的路徑例如:C:\foo.zip"
With Email.Configuration.Fields
.Item(NameSpace&"sendusing") = 2
.Item(NameSpace&"smtpserver") = "smtp.163.com" 'smtp服務(wù)器地址
.Item(NameSpace&"smtpserverport") = 25
.Item(NameSpace&"smtpauthenticate") = 1
.Item(NameSpace&"sendusername") = "賬戶名,發(fā)送郵箱的"
.Item(NameSpace&"sendpassword") = "密碼"
.Update
End With
Email.Send

注意代碼中的參數(shù)設(shè)置。

上一篇:關(guān)于vbs 生成靜態(tài)頁(yè)面過程中出現(xiàn)的問題

欄    目:vb

下一篇:用VBS修改(設(shè)置)系統(tǒng)時(shí)間和日期的代碼

本文標(biāo)題:獲取外網(wǎng)IP并發(fā)送到指定郵箱的vbs代碼[已測(cè)]

本文地址:http://www.jygsgssxh.com/a1/vb/7379.html

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有