Sendmail configuration

Enable access to the sendmail server from containers on the host. Find and edit /etc/mail/ accordingly to make it listen on the docker network and enable the relay:

DAEMON_OPTIONS(`Port=smtp,Addr=, Name=MTA')dnl

Grant relay access from the docker container network editing /etc/mail/access, e.g.:

Connect:localhost.localdomain           RELAY
Connect:localhost                       RELAY
Connect:                       RELAY
Connect:172                             RELAY

And don’t forget to rebuild the configuration and restart sendmail:

sudo m4 /etc/mail/ > /etc/mail/
sudo chmod 644 /etc/mail/
sudo /etc/init.d/sendmail restart