As shown in the name, the script for getting the Internet IP address and sending it to the specified mailbox is relatively short, but it is not as powerful as the au3 script provided by the script home, but it is good to record it every time the computer starts up.
''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 = "Send Email" Email. to = "receive Email" Email. subject = "topic" Email. textbody = ss & date () 'ss is the obtained ip address 'email. addAttachment "the attachment path is C: \ foo.zip" With Email. configuration. fields. item (NameSpace & "sendusing") = 2. item (NameSpace & "smtpserver") = "smtp.163.com" 'smtp server address. item (NameSpace & "smtpserverport") = 25. item (NameSpace & "smtpauthenticate") = 1. item (NameSpace & "sendusername") = "account name, email sending ". item (NameSpace & "sendpassword") = "password ". update End With Email. send
Pay attention to the parameter settings in the code.
For more articles on getting the Internet IP address and sending the vbs code to the specified mailbox, please follow the PHP Chinese network!