Laravel Gmail配置错误 [英] Laravel Gmail Configuration Error

查看:126
本文介绍了Laravel Gmail配置错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Gmail的Laravel电子邮件时遇到了这个问题,我检查并查看了关于Stack Overflow的许多问题,但在我的情况下仍然无法解决.我正在使用Laravel 5.4和Xampp.

I have been having this issue with Laravel email with Gmail and I have checked and reviewed so many questions on Stack Overflow but none still works in my case. I am using Laravel 5.4 and Xampp.

起初我以为是Xampp不允许发送电子邮件,但是当我转为实时模式(托管在共享主机上)时,那里仍然存在相同的问题

At first I thought it was my Xampp that cannot allow sending the emails but also when I move to the live mode(hosted it on a shared hosting) still have same issues there as well

但是每当我将配置设置为使用Mailtrap时,它便能正常工作,并且我知道mailtap只是一个开发邮件服务器,但是每当我使用Gmail时,它都会给我错误,例如"Expected response code 220 but got code "", with message """

But whenever I set the configuration to use Mailtrap, it's working and I know mailtap is just a development mail server, but whenever I use the Gmail it give me error such as "Expected response code 220 but got code "", with message """

此外,当我在实时模式下尝试时,它仍然会给出相同的错误.

Also when I try it on live mode it still gives same error.

我的配置文件具有以下内容

My configuration file has the following

.env

MAIL_DRIVER=smtp
MAIL_HOST=gmail-smtp-msa.l.google.com (also tried smtp.gmail.com)
MAIL_PORT=587
MAIL_USERNAME=email@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl

mail.php

<?php

return [


    'driver' => env('MAIL_DRIVER', 'smtp'),

    'host' => env('MAIL_HOST', 'gmail-smtp-msa.l.google.com'),


    'port' => env('MAIL_PORT', 587),

    'from' => [
        'address' => 'email@gmail.com',
        'name' => 'Name Here',
    ],

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),

     'username' => env('MAIL_USERNAME', 'email@gmail.com'),

    'password' => env('MAIL_PASSWORD', 'password'),



    'sendmail' => '/usr/sbin/sendmail -bs',
    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

];

推荐答案

以及Laravel方面的配置,您需要在您的Gmail帐户中启用安全性较低的应用程序" .

As well as the configuration on the Laravel side, you need to enable "Less secure apps" in your Gmail account.

在Laravel方面,本指南显示了您的设置需要.使用smtp.gmail.com作为主机,使用465/ssl587/tls.

On the Laravel side, this guide shows the settings you need. Use smtp.gmail.com for host, and either 465/ssl or 587/tls.

这篇关于Laravel Gmail配置错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆