Wes*_*iks 1 php email swiftmailer laravel
因此,我第一次尝试使用Laravelmailer,但是与mail()仅发送邮件的普通php相比,我遇到了一些问题。
我的laravel代码:
if(Mail::send('pages/mail', $data, function($message)
{
$message->from('webmaster@example.com', Input::get('name'));
$message->to('nobody@example.com')->subject('Welcome to My Laravel app!');
}))
{
return "success";
}
else
{
return Mail::failures();
}
Run Code Online (Sandbox Code Playgroud)
我的laravel错误响应:
"["nobody@example.com"]"
Run Code Online (Sandbox Code Playgroud)
(基本上是我输入的邮件地址to()。
如果我使用普通的php,mail()它会毫无错误地发送邮件(它只进入我的垃圾邮件文件夹,但这只是一个测试)。
知道可能是什么问题吗?
确保在以下位置使用了正确的邮件驱动程序config/mail.php:
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log"
|
*/
'driver' => 'mail',
Run Code Online (Sandbox Code Playgroud)