为了账号安全,请及时绑定邮箱和手机立即绑定

(Swift_TransportException(code: 0):

(Swift_TransportException(code: 0):

PHP
冉冉说 2021-12-03 18:44:36
我们已将电子邮件服务器从一个提供商更改为另一个。使用旧电子邮件设置而不是新电子邮件设置发送的位置。我不确定它是 Laravel 服务器还是电子邮件服务器。我将在这里使用我的域名:example.com我在 .env 中更改了新的电子邮件设置:MAIL_DRIVER=smtpMAIL_HOST=server.example.comMAIL_PORT=465MAIL_USERNAME=no-reply@example.comMAIL_PASSWORD=secretMAIL_ENCRYPTION=ssl当我们发送电子邮件时,我们会在 laravel.log 中收到此异常production.ERROR: Connection to tcp://server.example.com:465 Timed Out {"exception":"[object] (Swift_TransportException(code: 0): Connection to tcp://server.example.com:465 Timed Out at /var/www/example.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:473, Swift_IoException(code: 0): Connection to tcp://server.example.com:465 Timed Out at /var/www/example.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:166)我也试过用 tls 而不是 ssl 但同样的错误。我已经使用提供商提供的给定设置在 Thunderbird 中配置了该电子邮件 no-replay@example.com 并且工作正常。电子邮件设置:incoming: IMAP server.example.com 993 SSL/TLS Encrypted password outgoing: SMTP server.example.com 465 SSL/TLS Encrypted passwordusername (email address) and password.我错过了什么????
查看完整描述

2 回答

?
动漫人物

TA贡献1815条经验 获得超10个赞

就我而言,该错误具有误导性。这不是超时,而是由错误的加密设置引起的。

在我的情况下,我需要设置 MAIL_ENCRYPTION=ssl


查看完整回答
反对 回复 2021-12-03
?
鸿蒙传说

TA贡献1865条经验 获得超7个赞

如果您从 Gmail 帐户发送电子邮件,请尝试此操作


MAIL_DRIVER=smtp

MAIL_HOST=smtp.gmail.com

MAIL_PORT=465

MAIL_USERNAME=your_email (like abc@gmail.com)

MAIL_PASSWORD=secret (when you create a app in your google account then  get a app secret)

MAIL_ENCRYPTION=ssl


如果您在 Gmail 中执行此操作,则可以轻松地从您的 Gmail 帐户发送邮件


查看完整回答
反对 回复 2021-12-03
  • 2 回答
  • 0 关注
  • 262 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信