The Finest Hand-Selected Downloads
Individually reviewed & tested
Store News

Send emails from the command line with Blat

10 May 2012, Mike Williams

When you’re not around to monitor a PC then it’s often useful to get notifications of its key events. And so you might like to know when a particular program starts or ends, perhaps, or when the system closes down or restarts.

Some applications understand this already. Many backup programs are able to send an email to let you know when a particular job has completed, for instance: very convenient. And Windows Task Scheduler can also send emails for a host of different events. But if that’s not enough then you can always manually extend your system with Blat, a simple command line tool which allows you to send emails as appropriate from your own scripts and batch files.

The process starts by setting up Blat with your core email details. Running the program at the command line will display its various settings and syntax, but in general a minimal setup will look something like this (with the bold text all on one line).

Blat -SaveSettings -f your.address@domain.com -server mail.domain.com -u your.address@domain.com -pw password

Launch Blat at the command line for the full details of its switches and settings

(Replace the first “your.address@domain.com” with your sending address, “mail.domain.com” with your SMTP server, the second “your.address@domain.com” with your account user name, and “password” with, well, your password.)

Next, create a plain text file with the text of whatever email you’d like to send. And it really does need to be plain text, as Blat transmits the contents of the file rather than sending it as an attachment. Call it test.txt for now and save it in the same folder as Blat.

With that done you can then probably send an email with a line like this.

Blat test.txt -to recipient@domain.com

Where “recipient@domain.com” is the email address of whoever you’d like to receive the message.

If that doesn’t work then simply enter Blat at the command line for the details of other switches you can apply (there’s the option to decide the port you’ll use to send the message, for instance).

And once your test emails are being sent correctly then you can begin building the program into your scripts, ready to send notifications of whatever events you like.

Your Comments & Opinion

43,394,608
Downloads
Secure & Tested Software
6,454
Reviews
Instant Download 24/7
312,958
Members
10+ Years of Service