views:

579

answers:

2

I have a nightly batch job that can tell if it has failed. I want it to send me an email, possibly with an attachment when it does.

How can I send an email from a Windows Batch (.bat) file?

+3  A: 

If the SMTP-server that is a part of IIS is installed, you could use the Echo command to write a file to the pickup folder, and it'll get sent.

echo From: [email protected]>tmp.txt
echo To: [email protected]>>tmp.txt
echo Subject: hello>>tmp.txt
echo.>>tmp.txt
echo Hello world>>tmp.txt
copy tmp.txt \Inetpub\mailroot\Pickup
svinto
How would you do an attachment?
Mark Brackett
This isn't the way if you want attachment, use Blat or something. (Something could be running a VBScript calling CDOSYS.)
svinto
+4  A: 

Blat. Nothing more needs to be said. ;)

Mark Brackett