用php和sendmail发送邮件testingdocker容器

我在Ubuntu的16.04。 我有一个(testing)docker(docker组成)容器运行PHP 5.6和Apache 2.4。

随着生产平板(无docker)邮件发送与sendmail。

如何发送testing邮件在docker集装箱(与sendmail)?

预先感谢回复。

有用。

在Dockerfile中:

 # sendmail config ############################################ RUN apt-get install -q -y ssmtp mailutils # root is the person who gets all mail for userids < 1000 RUN echo "root=yourAdmin@email.com" >> /etc/ssmtp/ssmtp.conf # Here is the gmail configuration (or change it to your private smtp server) RUN echo "mailhub=smtp.gmail.com:587" >> /etc/ssmtp/ssmtp.conf RUN echo "AuthUser=your@gmail.com" >> /etc/ssmtp/ssmtp.conf RUN echo "AuthPass=yourGmailPass" >> /etc/ssmtp/ssmtp.conf RUN echo "UseTLS=YES" >> /etc/ssmtp/ssmtp.conf RUN echo "UseSTARTTLS=YES" >> /etc/ssmtp/ssmtp.conf # Set up php sendmail config RUN echo "sendmail_path=sendmail -i -t" >> /usr/local/etc/php/conf.d/php-sendmail.ini 

对于php sendmail容器里面的testing:

 echo "Un message de test" | mail -s "sujet de test" mailSendingAdresse@email.com 

我在这两个文件的帮助下成功了: