Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php laravel在gmail不工作的服务器上发送邮件_Php_Email_Laravel_Swiftmailer - Fatal编程技术网

Php laravel在gmail不工作的服务器上发送邮件

Php laravel在gmail不工作的服务器上发送邮件,php,email,laravel,swiftmailer,Php,Email,Laravel,Swiftmailer,嗨,在我的laravel应用程序中,当我创建一个新用户时,我正在发送邮件!!因此,在localhost中,我使用gmail smtp和我的gmail帐户和用户名,它工作正常,但在服务器上我遇到了这个错误 Swift_TransportException Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at

嗨,在我的laravel应用程序中,当我创建一个新用户时,我正在发送邮件!!因此,在localhost中,我使用gmail smtp和我的gmail帐户和用户名,它工作正常,但在服务器上我遇到了这个错误

Swift_TransportException
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 http://support.google.com/mail/bin/answer.py?answer=14257 pn5sm18998642wjc.4 - gsmtp "
这是我的密码

if ($user->save())
        {   
             View::composer('emails.auth.userMail', function($view)
                {
                    $mail = Input::get('email');
                    $pass = Input::get('password');
                  $view->with('username' , $mail )->with('password' , $pass );
                });

            Mail::send('emails.auth.userMail', $data, function($message) use ($user)
                {
                    $message->to(Input::get('email'), '')
                    ->subject('Nouveau compte Happy Road ');


                });
在mail.php中

'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'from' => array('address' => name@gmail.com', 'name' => 'name'),
'encryption' => 'ssl',
'username' => 'mymail@gmail.com',
'password' => 'mypassword',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,

通过为应用程序生成新密码解决了这个问题。我也遇到了同样的问题。要执行此操作,您需要转到

gmail安全部分


。然后将安全权限禁用更改为启用。就是这样。

您的电子邮件配置是什么?在config/mail.php上,通过为应用程序生成一个新密码来解决此问题,添加此密码作为答案,以便将来其他用户可以快速找到解决方案。您好,抱歉,我有一个相同的问题,您是什么意思?为应用程序生成一个新密码?您好,我使用我们自己的域。但我也遇到了这个问题:这是我的env文件MAIL\u DRIVER=smtp MAIL\u HOST=smtp.mydomain.com MAIL\u PORT=25 MAIL\u用户名=user@mydomain.comMAIL\u PASSWORD=mypassword MAIL\u FROM=user@mydomain.com邮件\u名称=无回复邮件\u加密=空