Php Laravel mail无法发送邮件

Php Laravel mail无法发送邮件,php,email,laravel,swiftmailer,Php,Email,Laravel,Swiftmailer,因此,我第一次尝试了Laravelmailer,但是与普通的phpmail()相比,我遇到了一些问题,后者只发送邮件 我的拉威尔代码: if(Mail::send('pages/mail', $data, function($message) { $message->from('webmaster@example.com', Input::get('name')); $message->to('nobody@example.com')->subject('We

因此,我第一次尝试了
Laravel
mailer,但是与普通的php
mail()
相比,我遇到了一些问题,后者只发送邮件

我的拉威尔代码:

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();
}
My laravel错误响应:

"["nobody@example.com"]"
(基本上是我放在
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',

确保在
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',

您的视图不应该是
页面。mail
?@hebron谢谢您的回复,它也可以运行,但您是对的,Laravel的约定使用DOTS。我将此帖子用作我的邮件联系人表单的指南,这很管用。嗯,这对我很管用。您确定在邮件配置中设置了正确的驱动程序吗?我将此作为答案发布。应该吗您的视图不是
页面。mail
?@hebron谢谢您的回复,它也可以运行,但您是对的,Laravel的约定使用DOTS。我将此帖子用作我的邮件联系人表单的指南,这很有效。嗯,这对我很有效。您确定在邮件配置中设置了正确的驱动程序吗?我将此作为答案发布。再次感谢!非常感谢。再次感谢!非常感谢。