在控制器上自定义Laravel邮件错误

时间:2018-01-02 07:05:48

标签: php laravel email laravel-5

我想要自定义Laravel邮件错误页面 现在我有这个页面错误

  

(1/1)Swift_TransportException       预期的响应代码250,但得到代码" 535",消息" 535-5.7.8不接受用户名和密码。了解更多信息       535 5.7.8 https://support.google.com/mail/?p=BadCredentials u13sm7041792wre.52 - gsmtp       "

in AbstractSmtpTransport.php (line 383)
at Swift_Transport_AbstractSmtpTransport->_assertResponseCode('535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials u13sm7041792wre.52 - gsmtp ', array(250))
in AbstractSmtpTransport.php (line 281)
at Swift_Transport_AbstractSmtpTransport->executeCommand('RSET ', array(250), array())
in EsmtpTransport.php (line 270)

但我想告诉我这个错误

我的标题

  

(1/1)Swift_TransportException   预期的响应代码250,但得到代码" 535",消息" 535-5.7.8不接受用户名和密码。了解更多信息   535 5.7.8 https://support.google.com/mail/?p=BadCredentials u13sm7041792wre.52 - gsmtp   "

我的照片

1 个答案:

答案 0 :(得分:0)

我用这个解决了它

try {
        $email = Mail::send('sendtestmail', ['text'=>$data], function ($message) use ($data){
            $message->from('test@gmail.com', $data);
            $message->to('test@yahoo.com')->subject('test subject');
           });
    } catch (\Exception $ex) {
         $params = [  'flag' => 'warning', 'flagMsg' => $ex->getMessage();
         return view("Setting::$page")->with($params);
    }