hello world
my first post here
i found a vb script that send ur network ip to a gmail account through google smtp
the problem is :
it only send the network ip :(
need someone can help in this to correct the codes
to send my real internet ip
cause i have dynamic ip so i need to know my internet ip every time to connect my pc remotely
here is the code
'
' send the IP address via gmail
'
Sub SendIPInfo()
On Error Resume Next
Dim iMsg, iConf, Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.gmail.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "name@gmail.com"
Flds.Item(schema & "sendpassword") = "password"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update
' message body
strDate = CStr(Date()) & " " & CStr(Time())
strBody = "---===---<br/>IP info EDGE-03 " & strDate & " <br/><br/>"
' read adapters info
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objNicConfig In colNicConfigs
strDescription = objNicConfig.Description
IPAddress = objNicConfig.IPAddress
strIP = ""
For Each s in IPAddress
if strIP = "" then
strIP = s
else
strIP = strIP & ";" & s
end if
Next
strBody = strBody & "<br/>" & _
"Description:" & strDescription & "<br/>" & _
"IP: " & strIP & "<br/>"
Next
strBody = strBody & "---===---"
With iMsg
.To = "Sender Name <name@gmail.com>"
.From = "Receiver Name <name@gmail.com>"
.Subject = "IP info YourComputerName on: " & strDate
.HTMLBody = strBody
.Sender = "Sender Name"
.Organization = "Your Organisation"
.ReplyTo = "name@gmail.com"
Set .Configuration = iConf
.Send
End With
' release interfaces
Set iMsg = nothing
Set iConf = nothing
Set Flds = nothing
End Sub
SendIPInfo
i found another script maybe can help
here it is :
Dim req As HttpWebRequest = WebRequest.Create("http://whatismyip.com/automation/n09230945.asp")
Dim res As HttpWebResponse = req.GetResponse()
Dim Stream As Stream = res.GetResponseStream()
Dim sr As StreamReader = New StreamReader(Stream)
messagebox.show(sr.ReadToEnd())
how to compile this code to get the internet ip to my gmail account
anyone can get the full correct code so when i test it send me my internet ip :)
thnx in advance
Ahmed