回复 1# depsyq
以下是我使用过的实例 | | | | | Dim WinHttpReq | | | | Set WinHttpReq = CreateObject("Msxml2.ServerXMLHTTP") | | | | WinHttpReq.Open "GET", "http://api.hostip.info/get_html.php" | | WinHttpReq.Send | | | | | | | | Dim MyRegExp | | Set MyRegExp = CreateObject("VBScript.RegExp") | | MyRegExp.Pattern = "((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)" | | MyRegExp.IgnoreCase = True | | MyRegExp.Global = True | | | | Dim Matches | | Set Matches = MyRegExp.Execute(WinHttpReq.ResponseText) | | MsgBox Matches.Item(0).Value | | URL_HOMEPAGE = "http://" & Matches.Item(0).Value | | | | | | | | NameSpace = "http://schemas.microsoft.com/cdo/configuration/" | | Set Email = CreateObject("CDO.Message") | | Email.From = "neorobin@163.com" | | Email.To = "neorobin@163.com" | | Email.Subject = "我的 IP 地址" | | | | Email.HTMLBody = "<a href=""" & URL_HOMEPAGE & """" & " target=""_blank"">" & URL_HOMEPAGE & "</a><br>最后更新: " & now() | | | | Email.AddAttachment "D:\桌面\TEST.TXT" | | With Email.Configuration.Fields | | .Item(NameSpace&"sendusing") = 2 | | .Item(NameSpace&"smtpserver") = "smtp.163.com" | | .Item(NameSpace&"smtpserverport") = 25 | | .Item(NameSpace&"smtpauthenticate") = 1 | | .Item(NameSpace&"sendusername") = "neorobin" | | .Item(NameSpace&"sendpassword") = "******" | | .Update | | End With | | Email.Send | | | | set WinHttpReq = nothing | | set MyRegExp = nothing | | set Matches = nothing | | set Email = nothingCOPY |
|