我的Symfony 4演示应用程序无法使用Dev默认swiftmailer配置发送电子邮件。我的应用在PHP-FPM Docker容器中我的swift邮件是
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] [] []
预先感谢。
我通过添加mailcatcher容器来解决此问题将其添加到您的Docker-Compose文件
mailcatcher:
image: yappabe/mailcatcher
ports:
- 1025:1025
- 1080:1080
,然后添加您的邮件URL config
MAILER_URL=smtp://mailcatcher:1025
您可以在YourDomain上查看电子邮件:1080