HOW-TO: Sending emails from the Command Line with Ubuntu Linux using sendEmail

For some time I had been of the opinion that sending emails from the Linux Command Line Interface (CLI) simply had to be more complicated than with Windows using Blat. Not so! Over the weekend I learned of sendEmail which offers equivalent functionality.

First I started by using the version in the Ubuntu Repository for the version of Ubuntu which happened to be loaded on the machine I was using at the time. I received mixed results. Reading the sendEmail web site, I learned that the 1.56 solves some TLS security problems. I checked the repository for Ubuntu 10.10 (Maverick Meerkat), the current stable release, and the 1.56 version was in that repository. Since sendEmail is written in Perl, therefor not binary code, I simply purged off the version I had installed, and manually installed via the Ubuntu 10.10 package. That took care of all of the errors I was seeing!

Suggested CLI sendEmail usage:

sendEmail -f "Michael Lueck <FROMaddy@domain.com>" -t "Michael Lueck <TOaddy@domain.com>" -u This is a way cool test from sendEmail -o message-file=mytestmessage.txt -s smtp.hostingprovider.com:587 -o tls=yes -xu USERID -xp PASSWORD -v -v

The double "-v" switch caused sendEmail to give a more verbose trace. You may safely drop both of those for production use. I did not check the source code to see just how many "-v" switches it will provide more details for, but two definitely was better than one in my case.