Smtp Gmail无法正常工作我在实时服务器中尝试了All

问题描述 投票:-1回答:2
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465 
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl

我尝试了ssl和tls与他们各自的代码,但显示Swift_TransportException连接无法与主机smtp.gmail.com建立[连接超时#110]

 Mail::send('email.contact', $data, function($message) use ($data){
           $message->from($data['email']);
           $message->to('[email protected]', 'Admin');
          });
laravel
2个回答
4
投票

一般不建议gmail在实时服务器上发送电子邮件,但如果您只是将其用于测试目的,请确保您在less secure app下允许https://myaccount.google.com/security为YES并允许在https://accounts.google.com/b/0/DisplayUnlockCaptcha上使用验证码。

执行上述操作后,只需清除缓存,电子邮件就可以正常运行。


2
投票

您尝试使用带有SMTP的465端口,这很好,但可以尝试使用587端口。

© www.soinside.com 2019 - 2024. All rights reserved.