我们已将电子邮件服务器从一个提供商更改为另一个提供商。使用旧电子邮件设置发送但不使用新电子邮件设置发送。我不确定它是 laravel 服务器还是电子邮件服务器。
我将在这里使用我的域名:example.com
我已经更改了 .env 中的新电子邮件设置:
MAIL_DRIVER=smtp
MAIL_HOST=server.example.com
MAIL_PORT=465
MAIL_USERNAME=no-reply@example.com
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=ssl
Run Code Online (Sandbox Code Playgroud)
当我们发送电子邮件时,我们会在 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)
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用 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 password
username (email address) and password.
Run Code Online (Sandbox Code Playgroud)
我错过了一些东西???