CopyCode The Code is as follows: ''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
Email. Send
Pay attention to the parameter settings in the code.