Laravel 5 Laravel邮件错误:连接到tcp://mail.example.com:465 超时

Laravel 5 Laravel邮件错误:连接到tcp://mail.example.com:465 超时,laravel-5,smtp,Laravel 5,Smtp,在Laravel中发送邮件不起作用。这是我的密码 MAIL_DRIVER=smtp MAIL_HOST=mail.example.com MAIL_PORT=465 MAIL_USERNAME=user@example.com MAIL_PASSWORD=password MAIL_ENCRYPTION=tls 它显示出错误 exception: "Swift_TransportException" message: "Connection to tcp://m

在Laravel中发送邮件不起作用。这是我的密码

MAIL_DRIVER=smtp
MAIL_HOST=mail.example.com
MAIL_PORT=465
MAIL_USERNAME=user@example.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
它显示出错误

exception: "Swift_TransportException"

message: "Connection to tcp://mail.example.com:465 Timed Out"

当我将
tls
替换为
ssl
时。邮件未发送且显示无错误。

请检查您的配置/Mail.php,以确保:

邮件驱动程序部分是
“驱动程序”=>env(“邮件驱动程序”、“smtp”),
而不是
'driver'=>env('MAIL\u driver','MAIL'),

已选中。这是smtp。检查收件人邮件中的“垃圾邮件”或“垃圾邮件”文件夹,有时电子邮件会发送到那里。您也可以检查此线程,它帮助解决了我的问题: