0

我的 symfony 4 演示应用程序无法使用 dev 默认 swiftmailer 配置发送电子邮件。我的应用程序位于 php-fpm docker 容器中,我对 swiftmailer 的配置是

MAILER_URL=smtp://localhost:25

这是我的日志

[2017-12-17 15:48:43] php.DEBUG: Warning: stream_socket_client(): unable to connect to localhost:25 (Cannot assign requested address) 

[2017-12-17 15:48:43] app.ERROR: Exception occurred while flushing email queue: Connection could not be established with host localhost [Cannot assign requested address #99] [] []

提前致谢。

4

1 回答 1

3

我通过添加一个 mailcatcher 容器来解决这个问题 将此添加到您的 docker-compose 文件中

mailcatcher:
    image: yappabe/mailcatcher
    ports:
        - 1025:1025
        - 1080:1080

然后添加您的邮件 url 配置

MAILER_URL=smtp://mailcatcher:1025

您可以在 yourdomain:1080 查看电子邮件

于 2017-12-17T22:42:16.943 回答