Sendmail in DOCKERized PHP-Application doesn't work Sendmail in DOCKERized PHP-Application doesn't work docker docker

Sendmail in DOCKERized PHP-Application doesn't work


Command line sendmail won't work in a container without some extended setup. The sendmail binary normally drops a file into a mailqueue directory for a mail server process to pick up and then send. This would require mounting some mail servers queue directories into a container or trying to run a sendmail process along with your container services. Both are not very "Dockery".

sSMTP

sSMTP is a simple MTA to deliver mail from a computer to a mail hub (SMTP server)

Install ssmtp in the container and configure /etc/ssmtp/ssmtp.conf to send email via a real smtp server.

You could run a mail server in another container, use an existing service, or use an external mail host. There would generally be a mail server running on the Docker host itself, but it may not always be addressable from the container or accessible in the same way across different hosts.

Then configure PHP to use ssmtp

sendmail_path = /usr/sbin/ssmtp -t