Tip of the day: local delivery with esmtp

This is the solution of a problem I had for quite a bit of time and I want to share it with anybody else who might find it intersting 🙂

In my system I don’t have a complete mailsystem, I just get the mail with fetchmail from some servers (gmail and a few mailboxes from my provider) then I inject it locally with maildrop and get it with dovecot.
The main problem I had lately is that the mails coming from cron or from apcupsd or similar needed to go somewhere, so I had ssmtp locally set up to send the mails through my provider to my gmail account. But that wasn’t fine as I had to delete the mails coming from cron in gmail as I don’t want to have them archived.

So what was the solution? Instead of using ssmtp I moved to using esmtp, and set it’s /etc/esmtprc this way:

mda = “/usr/bin/maildrop -d flame”
hostname = mail.libero.it:smtp

At this point all the mail that cron would send to whatever local used will be just passed to maildrop and will come in my inbox immediately.

I marked this package ~amd64 to use it by the way. I hope it can be of help to people.