Code used by VBS to obtain the Internet IP address and send it to the specified mailbox

Source: Internet
Author: User
I used to post articles about similar functions from my home. This article has different websites and has good implementation code. If you like it, you can test it.
Function GetIPAddress() Dim Flag, Source Set GetIPObj = WScript.GetObject("http://ipseeker.cn//") Flag = 0 For i=1 To 10    If GetIPObj.readyState = "complete" Then     Flag=1    Exit For    End If    WScript.Sleep 500 Next If Flag = 0 Then  GetIPAddress = "Get IP Address Time Out ..." Else  Source = GetIPObj.documentElement.innerText  Set Rep = New RegExp  Rep.Pattern="(\d+)\.(\d+)\.(\d+)\.(\d+)"  For Each result in Rep.Execute(Source)    GetIPAddress = result    Exit For  Next End IfEnd FunctionFunction MailTo(MailAddress)    Dim NameSpace, MailObject    NameSpace = "http://schemas.microsoft.com/cdo/configuration/"    Set MailObject = CreateObject("CDO.Message")    MailObject.From = "*****@21cn.com"    MailObject.To = MailAddress    MailObject.Subject = "IP Address Information"    MailObject.Textbody = Now & ": " & GetIPAddress()    MailObject.Configuration.Fields.Item(NameSpace & "sendusing") = 2    MailObject.Configuration.Fields.Item(NameSpace & "smtpserver") = "smtp.21cn.com"    MailObject.Configuration.Fields.Item(NameSpace & "smtpserverport") = 25    MailObject.Configuration.Fields.Item(NameSpace & "smtpauthenticate") = 1    MailObject.Configuration.Fields.Item(NameSpace & "sendusername") = "*****"    MailObject.Configuration.Fields.Item(NameSpace & "sendpassword") = "*****"    MailObject.Configuration.Fields.Update    MailObject.SendEnd FunctionMailTo ("******@qq.com")

For more information about the code used by VBS to obtain the Internet IP address and send it to the specified email address, refer to PHP!

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.