Thursday, June 28, 2012

Send Email using TLS from Windows scripting like VBS

The "CDO.Message" used in VBS does not work for TLS. So if no SSL or anonymous access is allowed within your protected network you will be forced to use an external command. Here is when the SendEmail Open Source Project will help. Just download the executable and you will be able to use it to send emails over TLS. Below is an example on how to use it with gmail TLS:
C:\>c:\scripts\sendEmail.exe -f gmailUserAddress -t gmailUserAddress -u "from sendEmail using TLS" -m "Just Testing" -s -o tls=yes -xu gmailUserAddress
.com -xp gmailUserPassword
This is handy if you are trying to monitor your event logs like I have posted before.


luis pimentel said...

Thank you for the post, it was very useful.

Do you know any other way of sending an email over TLS from VBS without running an external command?

With CDO.Message is not possible? Maybe another library?

Nestor Urquiza said...

@Luis, I don't believe CDO.Message supports that. Most likely Powershell would be where you should look for an alternative. Best, - Nestor