This morning I realized I had no sendmail functionality on my web server. This isn’t good, since many programs need to be able to, well, send mail. I had a couple of options. I could install Postfix or Exim, and take on the task of managing a whole mail system, or I could install a “nullmailer”. A simple program that forwards mail to an upstream server for further processing. There are a handful of good nullmailer programs available. The two I’m most familiar with are sSMTP and Nullmailer. Here’s a brief overview of the two.
Both Nullmailer and sSMTP do the same basic thing. They provide a drop-in replacement for the “sendmail” command. They support more or fewer of the arguments to sendmail, and for your average LAMP stack they’re both more or less identical. They provide a very simple service. they let you send mail to an upstream server for subsequent delivery. That’s it, end of the day, job is done. That’s 90% of the functionality.
Notably, most full-featured MTAs ( Mail Transport Agents (Postfix, Exim, qmail, Sendmail, Courier)) can be configured to function in a similar way, but they’re less than ideal, because they’re usually much larger products which require significant manual configuration and greater overhead, while providing a broader attack target for potential crackers. Because of this, it’s best to use one of the below utilities.
Nullmailer Strengths and weaknesses
Nullmailer does it’s job in the best way possible. Nullmailer runs a simple queue in /var, where messages are spooled when sendmail is called. This allows a user or application to quickly send a message and continue. A background service then processes the queue and sends it off. This has several advantages. First, if your upstream mail server is unreachable temporarily, your mail is still delivered when it returns. These failures can be caused by a shoddy or low-speed connection, firewall errors, DNS issues, or just as a fluke. Unfortunately, Nullmailer, as of ubuntu 12.04, lacks support for such critical features as starttls, making it useless for use with gmail or google apps.
sSMTP strengths and weaknesses
sSMTP is a different, simpler kind of beast. sSMTP uses a queue-less approach. Your message is delivered directly to the upstream server when you send it. This means at the time of sending, it will either succeed or fail. This is decidedly a weakness of sSMTP. However, sSMTP supports SSL and STARTTLS connections. For this reason alone, it’s preferable, if not mandatory, to use sSMTP in conjunction with a gmail or google apps outbound relay.
I’m using sSMTP. I’d rather use Nullmailer, for its many technical strengths, however, because STARTTLS is required by google apps, I’m relegated to using sSMTP. Apparently as of Nullmailer 1.10, Nullmailer has support for STARTTLS, but unless I can find a PPA for it, I won’t be upgrading.
That said, if my situation were different, for example, if I ran a fast local MTA on a dedicated server, I would probably prefer sSMTP. It’s fast and lightweight. When a full-featured, reliable, fast MTA is available to handle the queuing and processing, the speed and reduced footprint of sSMTP compared to Nullmailer would be preferable.
“This means at the time of sending, it will either succeed or fail.”
As a developer, this is preferable, I mostly use it to send mail to mailtrap.
Thanks. I used nullmailer was wondering about alternatives. Your post and comparisons were clear.