【问题标题】:Laravel driver 'mail' not sending an emailLaravel 驱动程序“邮件”不发送电子邮件
【发布时间】:2015-03-24 22:44:50
【问题描述】:

所以我阅读了关于在 Laravel 中发送邮件的 documentationtutorials,但我似乎无法弄清楚出了什么问题。邮件没有发送,但它也没有给我一个错误。

这是我用来发送邮件的代码:

$data=array(
'id'=>1
'email'=>'myemail@email.com',
'name'=>'test'
);

Mail::send('emails.mail', $data, function($message) use ($data)
        {
            $message->from('test@test.com', 'me');
            $message->to($data['email'],$data['name'])->subject('id: '. $data['id'] );
        });     

当然'email'=>'myemail@email.com' 被我的邮箱代替了。

我的config/mail.php

return array(
'driver' => 'mail',
'host' => '',
//etc I didn't change the rest
);

emails.mail 视图:

<!DOCTYPE html>
<html lang="en-US">
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <h2>Hello {{$name}}</h2>
        <p> ID: {{$id}}</p>
</body>
</html>

我不知道我在这里做错了什么。视图运行得很好。我在这里做错了什么?

【问题讨论】:

    标签: php email laravel


    【解决方案1】:

    理想情况下,使用 SMTP 服务(如 Mailgun、Mandrill 或 Amazon 的 SES)并配置 Laravel 以连接到该服务。

    从您的服务器直接发送的电子邮件通常会被识别为垃圾邮件,而且调试、获取报告等也更加困难。

    如果您仍想从本地邮箱发送,是否配置为发送电子邮件?如果没有,follow these instructions。如果是,那么您在日志中看到了什么?

    【讨论】:

      猜你喜欢
      • 2018-05-10
      • 2022-08-13
      • 2015-12-23
      • 2019-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-29
      • 2019-03-15
      相关资源
      最近更新 更多