I'm wondering whether there is a sendmail tool that would allow me to send emails without all the overhead we see in servers like Postfix. I use Postfix already, so I know how to set it up and all. But what I'm looking for is one simple sendmail command line tool to send emails from one server to the server running Postfix.

So... I'm running a cluster of machine in the cloud. One of those machines has Postfix installed and it works like a charm. I can send emails from any front end by saving the data in our system database and having a background task get that data and forward it to Postfix on that specific computer. So our software is taken care of, assuming the database is up, the mailer system backend is up, Postfix is up... when all of that is ready, emails start flowing as expected (we have two such installations and they both work just fine.)

Now... these cloud instances also run CRON tasks and some other subsystems that can end up sending an email (or at least attempt to do so.) By default that fails because no MTA is installed on those machines.

What I'm looking for is a way to have the ability to do:

prompt$ sendmail [email protected]
From: [email protected]
Subject: Problem Report

Here we go, the problem is that I don't want Postfix on  each machine.

Further, I'd like sendmail to be setup so if it can't connect to the computer running Postfix (maybe it's currently down) then the email message is not lost. Instead, it get saved in a file. For example, in /var/mail/root.

For sure, I don't want to have to run yet another server. I expect that sendmail tool to be a command line one runs when in need to send emails. That's all.

Anything like that available under Linux Ubuntu?

1 Answer 1


I think you may be greatly overestimating "all the overhead" involved in running Postfix. It seems that would solve your problems: messages would get queued and delivered when your central mailer is back up. That requires almost zero configuration in Postfix.

If you want something "simpler", there's nullmailer, but that still involves running a "server" to handle message queuing, so it's really just like postfix except you need to learn a new piece of software.

You could make your own using something like msmtp, which doesn't handle message queuing or anything but you could wrap it in a shell script to saved messages to a mailbox on failure. Something like:

cat >> $tmpfile <<EOF
From: [email protected]
Subject: Problem Report

Here we go, the problem is that I don't want Postfix on  each machine.

if ! msmtp < $tmpfile; then
  echo "Send failed; saving to mbox."
  cat $tmpfile >> /path/to/mailbox

You would probably want to add some locking to the above, or arrange to deliver into a Maildir-format mailbox or something.

  • As a note, a local lock can easily be obtained using flock /run/lock/sendmail.lock Commented Jul 5, 2018 at 1:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .