Send mail from a Windows script

Posted by Jörgen Lundberg on Stack Overflow See other posts from Stack Overflow or by Jörgen Lundberg
Published on 2008-09-30T09:08:05Z Indexed on 2010/04/15 14:23 UTC
Read the original article Hit count: 227

Filed under:
|
|
|
|

I would like to send mail from a script on a Windows Server 2003 Standard Edition. I think the server setup is pretty much out of the box.

The mail server is an Exchange one, and when you're on the internal network you can use plain old SMTP. I have done it from my machine with Perl, but unfortunately Perl is not available on the server.

Is there an easy way of doing this from a .bat-file or any other way that doesn't require installing some additional software?

Edit:
Thanks for the quick replies. The "blat" thingie would probably work fine but with wscript I don't have to use a separate binary.

I didn't see PhiLho's post the first time I edited and selected an answer. No need for me to duplicate the code here.

Just save the script to a file, say sendmail.vbs, and then call it from the command prompt like so:
wscript sendmail.vbs

© Stack Overflow or respective owner

Related posts about smtp

Related posts about email