Send Email from a Windows Command Line


The technology involved in sending an email message from your PC isn't particularly complicated.  You need an account with an outgoing SMTP mail server, which generally comes as part of the service provided by your Internet Service Provider.

You also need an email client application, such as Thunderbird or Windows Live Mail.   This takes your outgoing message and sends it to the SMTP server, which takes care of the actual transmission.

But there's no reason why an email client has to have a fancy Windows user interface.  It could just as easily be a command-line tool.  And that's exactly what Blat is.  It's a command-line email client for Windows, and you can download it from  It's free of charge.

But why would anyone want a command-line email client?  Actually, it's really useful.  For example, you might have a Windows scheduled task which, every day, runs a batch file to back up your PC or defrag the hard disk.  Just one more line in that batch file, and you can have it automatically email you a confirmation message.

Or, you could create a 2-line batch file which zips all your vitally-important data files into a single attachment and then uses Blat to send that attachment to your mailbox.  Hey presto, a simple, reliable offline backup mechanism using just 2 commands.

Using blat is relatively simple, once you get the hang of it.  There are numerous examples on the web site.  In a nutshell, you use the command line to specify the recipient's email address, the name of the file that contains the text of the message you want to send, the name of any file you want to include as an attachment, the name of the SMTP server to use, and your username and password for that server.

A couple of years ago, when I was writing a book, I used this technique to create a backup regime for the my_book.doc file.  I created the above-mentioned 2 line batch file, and put it on my Windows desktop as an icon.  Then, every time I added a new chunk of text to the file, a double-click on the icon was all it took to ensure that the latest version of the file was safely stored off-site in my Gmail account.



Got any more Hot Finds like this one?  Fill in the form at and let all our users know.

Please rate this article: 

Your rating: None
Average: 3 (3 votes)