php - AbstractSmtpTransport.php 中的 Swift_TransportException 第 404 行 : Connection to smtp. gmail.com:465 超时

标签 php email laravel laravel-5 laravel-5.1

我的目标是将激活链接发送给我的注册用户。


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

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c515d555043494f594e525d51592171653179717d75705c7b717d7570327f7371" rel="noreferrer noopener nofollow">[email protected]</a>
MAIL_PASSWORD=khdpqvwzbsvpixvx

我错过了什么吗?我不断得到:

Swift_TransportException in AbstractSmtpTransport.php line 404: Connection to smtp.gmail.com:465 Timed Out

最佳答案

在根项目下打开 .env 文件。在其中编辑以下行:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587 #Update from 465 to 587
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="135e525a5f4c464056415d525e562e7e6a767e727a7f53747e727a7f3d707c7e" rel="noreferrer noopener nofollow">[email protected]</a>
MAIL_PASSWORD=yourpassword

重新启动本地网络服务器并且它起作用了。

关于php - AbstractSmtpTransport.php 中的 Swift_TransportException 第 404 行 : Connection to smtp. gmail.com:465 超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33630220/

相关文章:

php - php 和 mysql 中的组存档

php - 如何在 PHP 电子邮件中插入超链接?

javascript - 如何使用通用的单个提交按钮提交多个表单时创建单个请求

mysql - Laravel group by 和 SUM

php - 在laravel 5.4中没有发件人地址的情况下无法发送消息

php - 我如何从 OpenCart 版本 1.5.1 中删除 index.php?route=common/home?

PHP 插入 MySQL 撇号

html - 电子邮件中的图像未显示

php - PHP 中的 ArrayAccess——通过引用分配给偏移量

wordpress - 联系表格 7 显示已发送消息但未收到电子邮件