大家好,我尝试使用mailgun发送电子邮件时遇到问题
这里我按照这个http://itsolutionstuff.com/post/mailgun-setup-with-laravel-5-exampleexample.html的教程,但我发现错误
类似于AbstractSmtpTransport.php第383行中的Swift_TransportException:预期响应代码250但得到代码" 530",带有消息" 530 5.7.1需要验证 "
我检查了所有.env,mail.php,service.php,运行php artisan config:缓存并重新启动服务器但仍面临同样的问题(我在我的localhost上运行)
这里是我的.env
MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.com
MAIL_PORT=587
MAIL_USERNAME=christian7andrew@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
这是我的mail.php
'driver' => env('MAIL_DRIVER', 'mailgun'),
'host' => env('MAIL_HOST', 'smtp.mailgun.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['address' => 'christian7andrew@gmail.com', 'name' => 'PTKP'],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME','christian7andrew@gmail.com'),
'password' => env('MAIL_PASSWORD','password'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
这是我的service.php
'mailgun' => [
'domain' => 'sandboxf750e42d86cc410fbca6e462c8356bcf.mailgun.org',
'secret' => 'key-secretdddecd93d0c17c7a1d30secret',
],
路线
Route::get('kirim/{id}', 'AdminController@kirim');
控制器
public function kirim(Request $request, $id){
$keluhan = keluhan::find($id)->toArray();
//dd($keluhan);
Mail::send('laporan.email', $keluhan, function($message) use($keluhan) {
$message->to($keluhan['email_address']);
$message->subject('Mailgun Testing');
});
return redirect('/');
}
有什么想法吗?请帮助,非常感谢