Mail transfer agent options
https://wiki.debian.org/Debate/DefaultMTA
System mail like cron need an MTA installed on the system, otherwise cron won't
send mails: (CRON) info (No MTA installed, discarding output)
Problem: How to configure a simple MTA which
- forwards system/cron mail
- is reachable from containers
There are two options:
- Install an MTA on the host, make it reachable from containers
- Deploy an smtp-relay as docker-container. BUT on the host there needs to be another MTA installed that would forward mails to the smtp-relay
- Ignore host system mail when using a smtp-relay container
Issues with the container approach:
- Cron sends out mails with a non-qualified FROM addr
cron doesn't support MAILFROM
please support /etc/mailname
Possible solutions/workarounds:
- Use cronie instead of cron, because it allows setting MAIL_FROM BUT cronie is currently only in experimental
- Wrapper shell like suggested in this comment
dma
dma https://github.com/corecode/dma https://wiki.debian.org/Debate/DefaultMTA/DMA https://salsa.debian.org/debian/dma Slick, no daemon, simple config, queing support
dma issues
Cronmail is rejected and queues up together with bounces see also Make MASQUERADE config setting override -f This is not solved with compiled latest master... Related debian bug report
msmtp-mta
- msmtp-mta
- https://github.com/marlam/msmtp-mirror
- starts a daemon
- Little documentation
- Example config file
msmtpis configurable via an~/.msmtprcor system-wide via/etc/msmtprc
Installation:
apt install msmtp-mta
systemctl start msmtpd
systemctl enable msmtpd
issues
Cronmails:
- In order to send mails users need to symlink a system-wide
/etc/msmtprcto a user specific~/.msmtprc! - Cronmails come in with a FROM:
root@FQDN, so the mailhub domain is added, not the sending host domain !
Other MTA options
All these (besides other) packages replace/conflict with the virtual mail-transport-agent package:
Small MTAs useful for smtp-relaying
- opensmtpd https://packages.debian.org/buster/opensmtpd https://www.opensmtpd.org/ https://github.com/OpenSMTPD/OpenSMTPD/
Fully blown MTAs
- exim4-daemon-light / exim4-daemon-heavy complicated config
- postfix
ssmtp
- no daemon, extremly slick, no queue support
-
Cronmail will fail like other mails sent simply to
rootwithout a fqdn:text $ echo hi | mail root smtp_1 | 503 H=($FQDN) [172.17.0.1] F=<root@$FQDN> rejected after DATA: header syntax (unqualified address not permitted: failing address
in "To:" header is: root): unqualified address not permitted: failing address in "To:" header is: root
Unmaintained MTAs
- esmtp-run THIS PROJECT IS NO LONGER BEING MAINTAINED
- nullmailer
- https://packages.debian.org/buster/nullmailer
- https://github.com/bruceg/nullmailer, last release 2018-10
- No documentation, just man pages
- No daemon, not reachable from containers
- Queue at
/var/spool/nullmailer/ - Super easy configuration. Example config:
/etc/nullmailer/adminaddr: USER/etc/nullmailer/defaultdomain: FQDN/etc/nullmailer/remotes:MAILHOST smtp --port=587 --starttls --user=varac --pass=…