Skip to content

Instantly share code, notes, and snippets.

@tushroy
Created July 16, 2014 16:01
Show Gist options
  • Save tushroy/1feff058704fb1dc75ce to your computer and use it in GitHub Desktop.
Save tushroy/1feff058704fb1dc75ce to your computer and use it in GitHub Desktop.
Dim http
Set http = CreateObject("MSXML2.ServerXmlHttp")
http.open "GET", "http://ifconfig.me/ip", False
http.send
Dim ipText
ipText = http.responseText
Set http = Nothing
Set objMail = CreateObject("CDO.Message")
Set objConf = CreateObject("CDO.Configuration")
Set objFlds = objConf.Fields
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'cdoSendUsingPort
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" 'your smtp server domain or IP address goes here
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465 'default port for email
'comment out next four lines if you need not to use SMTP Authorization
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "pass"
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
objFlds.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'cdoBasic
objFlds.Update
objMail.Configuration = objConf
objMail.From = "H4X3R<[email protected]>"
objMail.To = "[email protected]"
objMail.Subject = "Email Subject Text"
objMail.TextBody = "The message of the email...ip: " & ipText
objMail.Send
Set objFlds = Nothing
Set objConf = Nothing
Set objMail = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment