I found I can not send email with php in dokcer, because the ssmtp not installed.
I added following section in Dockerfile:
...
# install MTA
RUN apt-get update && apt-get install -y ssmtp
MAINTAINER hongyi.chen
# Sendmail
COPY ./ssmtp.conf /etc/ssmtp/ssmtp.conf
...
The SSMTP config like this:
root=postmaster
AuthUser={{smtp_username}}
AuthPass={{smtp_password}}
mailhub={{smtp_host}}:{{smtp_port}}
UseTLS=YES
UseSTARTTLS=YES
rewriteDomain={{force_domain}}
hostname={{host_name}}
Ref:
https://linuxhandbook.com/linux-send-email-ssmtp/
https://www.techrepublic.com/blog/it-security/use-ssmtp-to-send-e-mail-simply-and-securely/