1

The following command (using the one and only original sendmail) sends an email:

echo "Subject: Testing Email" | cat - body.txt \
| /usr/lib/sendmail -v -F some@body.com -t some@body.else.com

WordPress and others use it in a similiar fashion.

Invoking it like that from within a docker container gets stuck, even though DNS (for MX lookup) and the MTA are reachable and the container is running privileged. People come up with all kinds of workarounds like using ssmtp which involve the setup of a dedicated MTA for the container. Given DNS and MX are available, I do not see a necessity for a dedicated MTA.

Why does the (one and only original) sendmail executable fail to send emails from within docker containers?

Andreas Steffan
  • 6,039
  • 2
  • 23
  • 25
  • Is the answer from Todd Lyons relevant for you http://stackoverflow.com/questions/28922051/how-to-configure-exim-with-docker-for-sendmail ? – user2915097 May 06 '15 at 07:01
  • Not quite. Just tried it out. It ends "Completed" but the mail does not show up in my inbox. Would still be valuable though if one could make it a sendmail replacement working without a dedicated MTA. But I would still like to know why the original sendmail fails since other programs may misbehave similarily. – Andreas Steffan May 06 '15 at 07:24
  • in https://github.com/docker-library/wordpress/issues/30 Tianon says "This was a hole we've had on our radar for a long time now, but didn't have a good solution." and in http://serverfault.com/questions/631941/send-mail-from-docker-container-with-hosts-postfix see what masegaloeh says – user2915097 May 06 '15 at 07:34
  • In fact, I am subscribed to that issue on github. Postfix sendmail variant may be a whole different story. I would really like to understand why exactly the original sendmail is failing. – Andreas Steffan May 06 '15 at 07:51
  • I have answered a similar question recently using msmtp https://stackoverflow.com/questions/26215021/configure-sendmail-inside-a-docker-container/30021595#30021595 – xuhdev May 06 '15 at 08:14
  • I know. The essence of this question here is in my comment over there. ;) – Andreas Steffan May 06 '15 at 08:45

0 Answers0