Obtain the vbs code of the Internet IP address and send it to the specified mailbox

Source: Internet
Author: User
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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.