我的symfony 4演示应用程序无法使用dev默认swiftmailer配置发送电子邮件。我的应用程序在一个php-fpm docker容器中,我的conf为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] [] []
提前致谢。
我通过添加一个mailcatcher容器来解决这个问题。将它添加到你的docker-compose文件中
mailcatcher:
image: yappabe/mailcatcher
ports:
- 1025:1025
- 1080:1080
然后添加您的邮件程序URL配置
MAILER_URL=smtp://mailcatcher:1025
您可以在以下网址查看电子邮件:1080