RUN apt-get update && \ apt-get install -y msmtp && \ apt-get clean && \ echo "account yandex" >> ~/.msmtprc && \ echo "logfile ~/.msmtp.log" >> ~/.msmtprc && \ echo "host smtp.yandex.ru" >> ~/.msmtprc && \ echo "port 587" >> ~/.msmtprc && \ echo "from no-reply@serov.eu" >> ~/.msmtprc && \ echo "keepbcc on" >> ~/.msmtprc && \ echo "auth on" >> ~/.msmtprc && \ echo "user no-reply@serov.eu" >> ~/.msmtprc && \ echo "password Uzum2G9pkZt" >> ~/.msmtprc && \ echo "tls on" >> ~/.msmtprc && \ echo "tls_starttls on" >> ~/.msmtprc && \ echo "tls_certcheck off" >> ~/.msmtprc && \ chmod 0600 ~/.msmtprc && \ cp -p ~/.msmtprc /etc/.msmtp_php && \ chown www-data:www-data /etc/.msmtp_php && \ touch /var/log/msmtp.log && \ chown www-data:www-data /var/log/msmtp.log
в php.ini
sendmail_path = "/usr/bin/msmtp -C /etc/.msmtp_php --logfile /var/log/msmtp.log -a yandex -t"
Другие конфиги
account yandex logfile /var/log/msmtp.log host smtp.yandex.ru port 587 from mail@yandex.ru keepbcc on auth on user mail@yandex.ru password пароль tls on tls_starttls on account yahoo tls on tls_starttls off tls_certcheck off auth on host smtp.mail.yahoo.com user user1 from user1@yahoo.com password yourYahooPa5sw0rd account gmail tls on tls_certcheck off auth on host smtp.gmail.com port 587 user user1@gmail.com from user1@gmail.com password yourgmailPassw0rd
Тестирование:
echo -e "test message" | /usr/bin/msmtp --debug -t -i name@site.ru