As I described earlier, I’ve been using sSMTP for email support in Docker containers. Unfortunately, sSMTP is not maintained anymore. Instead msmtp should be used. I put the migration off for as long as possible, but eventually implemented the change!

For legacy reasons I will leave my orginal articles about sSMTP untouched (I’ll just add a link to this page), and instead post this migration how-to.


Let’s assume we’ve been using the following sSMTP config in /etc/ssmtp/ssmtp.conf:


In addition, we somewhere needed to tell the system/software/module how to send mails. For example, for PHP it would be somthing like that in /usr/local/etc/php/conf.d/mail.ini:

[mail function]
sendmail_path = "/usr/sbin/ssmtp -t"


In that case you would need a msmtp configuration in /etc/msmtprc:

port 25
tls on

account default
auth off
host RELAY
from webserver@HOSTNAME
add_missing_date_header on

In addition, you need to tell the system/software/module send mails via /usr/bin/msmtp -t. For example, for PHP it would be somthing like that in /usr/local/etc/php/conf.d/mail.ini:

[mail function]
sendmail_path = "/usr/bin/msmtp -t"

Please note that msmtp is in /usr/bin not /usr/sbin !! ;-)

Supplemental Material

  • The paths mentioned above are target paths. Thus, if you’re using Docker it actually doesn’t matter where you store the files, but you need to mount them to those paths inside the container..
  • There are much more options for msmtp! You can also configure an actual mail account at Posteo or Google or wherever. I recommend checking its documentation and Arch’s Wiki.

Martin Scharm

stuff. just for the records.

Do you like this page?
You can actively support me!

1 comment

opk | Permalink |

For a completely minimal MTA, I’d recommend the dragonfly mail agent - dma. It has modern features such as being able to authenticate with client certificates. It comes from dragonflybsd, is included in base on freebsd but is also ported to Linux.

Leave a comment

There are multiple options to leave a comment: