I need to send an email from a batch script. I tried several solutions without success.
For example, with Blat:
:send_mail
"\Program Files (x86)\blat275\full\blat.exe"
-server smtp.gmail.com
-port 525
-f [email protected]
-to [email protected]
-s "hello"
-body "world"
When I run the script, I just get a Windows crash:
Does someone have a better solution?
EDIT & SOLUTION
I tried on our server (with our smtp) and it worked with Blat. See the full code in my answer below.
Realize this is old, but for any googlers:
Blat will NOT work with gmail, as it requires an SSL connection to be accessed over SMTP, which blat doesn't (as of 06/02/2013) support
See here: http://www.jeffkastner.com/2010/01/blat-stunnel-and-gmail/ for a (slightly messy) workaround.