首页 文章

Laravel Mail适用于一个但不适用于其他

提问于
浏览
0

对于这个网站,我有一个联系表格,它只是发送这样的邮件:

Mail::send('emails.contact', $input, function ($m) {
    $m->from(Input::get('email'), Input::get('name'));
    $m->to('secretaris@****.nl', 'Secretaris ****')->subject('Contactform: '. Input::get('name'));
});

$ input变量很简单:

$input = Input::all();

然后视图看起来像这样:

<html>
<body>

<b>{{$name}} ({{$mail}}) sent u a message via the contactform on ****.nl</b>
<br>
<div>
{{$message}}
</div>
<br>

</body>
</html>

这封邮件 does 发送 . 但是这个不知何故不是:

Mail::send('emails.registermember', $data, function ($m) {
    $m->from('no-reply@****.nl', 'No-Reply ****');
    $m->to('secretaris@****.nl', 'Secretaris ****')->subject('Registration of ' . ucfirst(Input::get('firstname')) . ' as Register-member');
});

这里的$ data值是:

$data = [
    'naam' => ucfirst($user->voornaam) . ' ' . ucfirst($user->achternaam),
    'id' => $user->id,
];

随着观点:

<html>
<body>
<p>
    <b>{{$name}}</b> registered as register member at website of ****.
</p>

</body>
</html>

此邮件不发送并执行Mail :: failures()返回:

[
"secretaris@****.nl",
]

我没有看到这些邮件功能之间有什么区别,为什么一个工作而另一个没工作 .

出于隐私原因,我用****标记了网站名称

我希望有人可以帮助我!

谢谢

1 回答

  • 1
    • 我怀疑错误在这一行

    $m->from('no-reply@****.nl', 'No-Reply ****');

    • 请检查您是否可以通过Laravel通过此电子邮件发送电子邮件

    no-reply@****.nl

    • 检查是否在 .env 文件中正确配置

相关问题