I recently moved postfix into a docker container, with ports 25 and 587 exposed on the host machine.
Since doing this, cron on the host machine is now unable to send emails due to
No MTA installed, discarding output.
It appears that cron tries to use the
sendmail command, which is normally provided by an MTA package. Installing postfix on the host to provide sendmail seems a bit silly, and it will try to listen on port 25 and conflict with the mappings from the dockerised postfix.
I tried installing
msmtp and adding a
account default host localhost auto_from on maildomain [domain]
Cron now tries to send mail through postfix, but even with the auto_from and maildomain options it seems to use a bare or invalid from header like
From: root or
From: root (Cron Daemon), which gets rejected. opendkim can't handle this either.
I'm assuming that when postfix was installed on the host, the postfix provided
sendmail sorted out all of the addresses and appended the
mailname as needed, but that the minimalist msmtp isn't doing this?
What is the solution here? How can I get a sensible
sendmail command on the host that will use the dockerised postfix to send the mail?