使用 Laravel 发送邮件
Send mail with Laravel
我尝试用 Laravel 发送邮件,但它不起作用。
我试过使用 Mandrill、mailgun 和 gmail。 Mandrill returns 消息类似于 "missing SPF and DKIM".
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME="my gmail adress"
MAIL_PASSWORD="my gmail password"
MAIL_ENCRYPTION=tls
MAIL_PRETEND=true
在我的 EmailController 中:
Mail::send('emails.welcome', ['name' => 'Novice'], function($message){
$message->to('f***@gmail.com', 'Fabien')->subject('Bienvenue !');
});
那是路线:
Route::resource('emails', 'EmailController');
我该如何解决?
将 MAIL_PRETEND
更改为 false
。该选项用于测试发送邮件不发送。
此外,由于 Laravel 5.2 选项 pretend
将不再存在。
The pretend
mail configuration option has been removed. Instead, use the log
mail driver, which performs the same function as pretend
and logs even more information about the mail message.
我尝试用 Laravel 发送邮件,但它不起作用。 我试过使用 Mandrill、mailgun 和 gmail。 Mandrill returns 消息类似于 "missing SPF and DKIM".
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME="my gmail adress"
MAIL_PASSWORD="my gmail password"
MAIL_ENCRYPTION=tls
MAIL_PRETEND=true
在我的 EmailController 中:
Mail::send('emails.welcome', ['name' => 'Novice'], function($message){
$message->to('f***@gmail.com', 'Fabien')->subject('Bienvenue !');
});
那是路线:
Route::resource('emails', 'EmailController');
我该如何解决?
将 MAIL_PRETEND
更改为 false
。该选项用于测试发送邮件不发送。
此外,由于 Laravel 5.2 选项 pretend
将不再存在。
The
pretend
mail configuration option has been removed. Instead, use thelog
mail driver, which performs the same function aspretend
and logs even more information about the mail message.