laravel 预期响应代码 250,但得到代码“530”
我试图在Laravel 5.1中邮寄
我的邮件.php代码是
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'myemail@gmail.com', 'name' => 'sample'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => env('MAIL_PRETEND', false),
];
我的 .env 文件是
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=null
我的电子邮件功能是
public function sendEmailVerification()
{
$user = $this->user;//retrieved by $request->user() in __construct
Mail::send('emails.verifyemail', ['user' => $user], function ($m) use ($user) {
$m->from('myemail@gmail.com, 'sample');
$m->to($user->email, $user->name)->subject('Verify Email');
});
}
每次调用我的函数时都会出现错误。
预期的响应代码 250,但收到代码“530”,并带有消息“530 5.7.0 必须首先发出 STARTTLS 命令”。l188sm21749863pfl.28 - gsmtp”