对于这个网站,我有一个联系表格,它只发送这样的邮件:
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>
此邮件确实发送。但这一个不知何故没有:
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>
此邮件不发送并且执行邮件::failures()返回:
[
"secretaris@****.nl",
]
我不明白这些邮件功能之间有什么区别,也不明白为什么一个有效,另一个无效。
出于隐私原因,我用***标记了网站名称
我希望有人能帮我!
感谢
- 我怀疑错误在这行
$m->from('no-reply@****.nl', 'No-Reply ****');
- 请检查您是否可以通过Laravel通过此电子邮件发送电子邮件
no-reply@****.nl
- 检查
.env
文件中的配置是否正确