我尝试使用带有gmail的laravel 5.5发送电子邮件时收到错误.
MAIL_DRIVER=smtp
MAIL_HOST=gmail-smtp-msa.l.google.com
MAIL_PORT=587
MAIL_USERNAME=mygmailadress
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
Run Code Online (Sandbox Code Playgroud)
我将邮件主机从smtp.google.com更改为了那个,因为我无法访问smtp.google.com
这是我尝试发送邮件时遇到的错误
stream_socket_enable_crypto(): Peer certificate CN=`smtp.gmail.com' did not match expected CN=`gmail-smtp-msa.l.google.com'
Run Code Online (Sandbox Code Playgroud)
这是我在使用mail_host smtp.google.com时使用的错误
Connection could not be established with host smtp.google.com
[php_network_getaddresses: getaddrinfo failed: Name or service not known #0
Run Code Online (Sandbox Code Playgroud)
请注意,我的测试服务器mailtrap一切正常.那么我怎样才能将这项工作用于生产?
你在邮件主机中有错误 MAIL_HOST=smtp.gmail.com
根据您的问题,您已经使用了MAIL_HOST=gmail-smtp-msa.l.google.com和MAIL_HOST=gmail-smtp-msa.l.google.com
但是gmail主机是 smtp.gmail.com
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=mygmailadress
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7239 次 |
| 最近记录: |