stream_socket_enable_crypto():SSL操作失败,代码为1-Laravel 7

时间:2020-09-08 18:54:30

标签: laravel-7 google-workspace

我正在尝试使用Google的SMTP服务器从Laravel 7.x应用程序发送电子邮件。 我正在使用的配置设置是从我的其他Laravel应用程序复制的(更改了凭据)。

我的Gsuite帐户启用了两步验证,并且我在.ENV文件中使用了应用程序密码

但是,每次都会出现以下错误:

 Failed to authenticate on SMTP server with username "hello@xxxxx.com" using 3 possible 
 authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with 
 message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 
 https://support.google.com/mail/?p=BadCredentials gb19sm28030pjb.38 - gsmtp ". Authenticator PLAIN 
 returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and 
 Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials 
 gb19sm28030pjb.38 - gsmtp ". Authenticator XOAUTH2 returned Expected response code 250 but got code 
 "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 
 https://support.google.com/mail/?p=BadCredentials gb19sm28030pjb.38 - gsmtp ". 

我的.env条目如下所示:

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=hello@xxxx.com
MAIL_PASSWORD=hqubwafijjkkvexnah
MAIL_ENCRYPTION=tls

问题出在Goog; le的smtp上,因为当我指向邮件陷阱时,一切正常。

1 个答案:

答案 0 :(得分:0)

我设法通过将缺少安全应用更改为打开,并关闭关闭两步验证来解决此问题。但是从长远来看,我不认为这是我想要的方法。

目前,此问题已解决