dongzhe6287 2014-09-24 09:50
浏览 160
已采纳

Laravel邮件无法发送邮件

So for the first time I tried Laravel mailer but I encountered some problems vs the normal php mail() which just sends the mail.

My laravel code:

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 error response:

"["nobody@example.com"]"

(basically the mail address I put in to().

If I use the normal php mail() it sends the mail without error (it only came into my spam folder but it was just a test).

Any idea what the problem might be?

  • 写回答

1条回答 默认 最新

  • duanjiu4498 2014-09-24 10:26
    关注

    Make sure you are using the correct mail driver in 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',
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题