laravel 邮件Expected response code 250 but got code "530"with message "530 Authentication required
laravel 发送邮件抛出如下错误
Swift_TransportException in AbstractSmtpTransport.php line 383:
Expected response code 250 but got code "530", with message "530 Authentication required
"
错误提示的意思是邮箱服务器未通过,但我的账号密码是正确的啊。求支援。----------mail.php 配置文件为:
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.sina.com'),
'port' => env('MAIL_PORT', 25),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'xxxx@sina.com'),
'name' => env('MAIL_FROM_NAME', '发件人'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
发送邮件的方法为
public static function sendEmailTest(){
$uid = 'uid123';
$code = 'activeCode';
$data = ['uid'=>$uid, 'activationcode'=>$code];
Mail::send('email/activemail', $data, function($message)
{
$message->to('xxx@qq.com')->subject('欢迎注册我们的网站,请激活您的账号!');
});
}
求大神支援。。。
1 Comment
'name' => env('MAIL_FROM_NAME', '发件人' 。 ‘发件人’ 此处修改为你的邮箱地址。