问题描述
在阅读了大量解决方案的测试后,我仍然收到此错误.
After reading an testing a lot of solutions, I still getting this error.
我的参数.yml
parameters:
database_host: 127.0.0.1
database_port: null
database_name: symfony
database_user: root
database_password: null
secret: holamundo
mailer_transport: smtp
mailer_encryption: ssl
mailer_port: 465
mailer_auth_mode: login
mailer_host: smtp.gmail.com
mailer_user: justexample@gmail.com
mailer_password: nottherealone
还有我的 config.yml
And my config.yml
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
encryption: %mailer_encryption%
auth_mode: %mailer_auth_mode%
host: %mailer_host%
port: %mailer_port%
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
并通过命令行测试 swiftmailer...
And testing swiftmailer trough command line...
php bin/console swiftmailer:email:send
我收到此错误:
[app] Exception occurred while flushing email queue: Connection could not be established with host smtp.gmail.com [ #0] [] []
如果我 ping 'smtp.gmail.com' 我会得到回复.
If I ping 'smtp.gmail.com' I get a response back.
我在 localhost:8000 上运行 symfony,很多人说将 mailer_host 更改为类似...
I'm running symfony on localhost:8000, many people say to change mailer_host to something like...
mailer_host: 127.0.0.1
但是我在不同的端口上运行它,所以如果我把它
But I'm running it on a different port, so if I put this
mailer_host: 127.0.0.1:8000
甚至这个
mailer_host: 127.0.0.1
mailer_port: 8000
我明白了:
ERROR [app] Exception occurred while flushing email queue: Expected response code 220 but got code "", with message "" [] []
谢谢!
推荐答案
尝试停用您的防病毒软件.Avast 阻止了我的发送电子邮件操作,Symfony 3 给了我同样的错误信息!!希望有帮助
Try deactivating your antivirus. Avast was blocking my send email action and Symfony 3 gave me that same error message!!hope it helps
这篇关于Symfony2 SwiftMailer 无法与主机 smtp.gmail.com 建立连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!