laravel 连接到 tcp://smtp.mail.yahoo.com:465 超时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38341424/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 14:08:29  来源:igfitidea点击:

Connection to tcp://smtp.mail.yahoo.com:465 Timed Out

phplaravelemaillaravel-5smtp

提问by cyber8200

I'm really struggling with this error :

我真的在为这个错误而苦苦挣扎:

Swift_TransportException in AbstractSmtpTransport.php line 404: Connection to tcp://smtp.mail.yahoo.com:465 Timed Out

AbstractSmtpTransport.php 第 404 行中的 Swift_TransportException:连接到 tcp://smtp.mail.yahoo.com:465 超时

I hope someone can shed some light on this.

我希望有人能对此有所了解。

Here are my settings in my .envfile

这是我在我的.env文件中的设置

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mail.yahoo.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=******

回答by cyber8200

I notice in /config/mail.php, I see

我注意到了/config/mail.php,我看到了

'encryption' => env('MAIL_ENCRYPTION', 'tls'),

'encryption' => env('MAIL_ENCRYPTION', 'tls'),

By updating it to

通过将其更新为

'encryption' => env('MAIL_ENCRYPTION', 'ssl'),

'encryption' => env('MAIL_ENCRYPTION', 'ssl'),

Now, it is working fine. My email is sending out now.

现在,它运行良好。我的电子邮件现在正在发送。

回答by stevebaros

With Laravel 6.x and 7.x

使用 Laravel 6.x 和 7.x

it is advisable to use SSL over the default tls.

建议在默认 tls 上使用 SSL。

Most shared hosting providers sign emails with SSL so edit your .env file to have this

大多数共享主机提供商使用 SSL 签署电子邮件,因此请编辑您的 .env 文件以拥有此

MAIL_ENCRYPTION=ssl