连接无法建立主机smtp.gmail.com
试图发送电子邮件与Swiftmailer,我得到了这个错误。我和配置swiftmailer:连接无法建立主机smtp.gmail.com
transport: smtp
host: smtp.gmail.com
username: [email protected]
password: password
port: 587
encryption: ssl
我总是收到此错误信息:
Connection could not be established with host smtp.gmail.com
我也试过用:
transport: gmail
host: smtp.gmail.com
username: [email protected]
password: password
port: 587
encryption: ssl
完整错误讯息是
[YYYY-mm-dd hh:ii:ss] app.ERROR: Exception occurred while flushing email queue: Connection could not be established with host smtp.gmail.com [ #0]
其他问题:
我的情况是this不同。在我的情况下,我没有Avast杀毒软件。
编辑:在
Exception occurred while flushing email queue: Failed to authenticate on SMTP server with username "my email address" using 1 possible authenticators
改变端口465,亚历克斯Howansky建议,埃罗改变它寻找服务器smtp.gmail.com但不能够解决它。使用此域smtp.gmail.com和端口25或465.
谁在寻找“mail.website.com”? – sensorario
我编辑它是smtp.gmail.com –
所以,...你建议将smtp.gmail.com:465更改为smtp.gmail.com:465。有趣。 – sensorario
1:要么您必须允许不太安全的应用程序或使用应用程序的密码,通过启用2步验证您的gmail acc。 2:禁用你的机器上的任何防病毒(这是没有人会告诉你,但在许多情况下是必要的)。 3:不要忘记清除缓存(有时它不会从.env文件中获取更新的内容) 4:您不需要在配置目录中的Mailer中更改任何内容(不推荐),您应该使用env变量
端口587不是SSL。您可能需要端口465.请参阅[这里](https://www.lifewire.com/what-are-the-gmail-smtp-settings-1170854)。 –
您可能需要按照[此处]所述切换_“使用安全性较低的应用程序”_设置(https://stackoverflow.com/questions/29098781/script-sending-mails-with-gmail-failed-to-authenticate- SMTP服务器上)。 –
已经完成。感谢您的建议。 – sensorario