Вопрос:

Sendmail in DOCKERized PHP-Application doesn't work

php apache email docker sendmail

821 просмотра

1 ответ

1084 Репутация автора

When trying to send an email with PHP

function sendmailoversmtp($name, $mail, $message, $topic)

It does not work. The following error is logged:

sh: 1: -t: not found

-t -i is configured as sendmail_path in my php.ini. Why is it not found?

My Dockerfile is based on FROM php:7.0-apache

Автор: Pascal Источник Размещён: 22.08.2016 08:24

Ответы (1)


0 плюса

35495 Репутация автора

Решение

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
Автор: Matt Размещён: 22.08.2016 10:37
Вопросы из категории :
32x32