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

问题描述:

For this website I have a contact form, which simply sends a mail like this:

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'));
});

The $input variable is simply:

$input = Input::all();

Then the view looks like this:

<html>
<body>

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

</body>
</html>

This mail does send. But this one somehow doesn't:

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');
});

The $data value here is:

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

With the view:

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

</body>
</html>

This mail does not send and doing Mail::failures() returns:

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

I don't see what's the difference between those mail functions, and why one works and the other doesn't.

For privacy reasons I marked the website name with ****

I hope someone can help me out!

Thanks

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

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

$ input变量只是: p>

  $  input = Input :: all(); 
  code>  pre> 
 
 

然后视图如下所示: p>

 &lt; html&gt  ; 
&lt; b&gt; 
 
&lt; b&gt; {{$ name}}({{$ mail}})通过****上的联系表单发送消息.nl&lt; / b&gt; 
&lt; br&gt; \  N'LT; DIV&GT; \ N {{$消息}} 
&LT; / DIV&GT; 
&LT峰; br&GT; 
 
&LT; / BODY&GT; 
&LT; / HTML&GT; 
 代码>  PRE> 
 \  n 

此邮件发送 strong>。 但是这个不知道: p>

  Mail :: send('emails.registermember',$ data,function($ m){
 $ m-&gt; from  ('no-reply@****.nl','No-Reply ****'); 
 $ m-&gt; to('secretaris @ ****。nl','Secretaris ***  *') - &gt; subject('注册'.ucfirst(输入:: get('firstname'))。'作为Register-member'); 
}); 
  code>  pre> \  n 
 

此处的$ data值为: p>

  $ data = [
'naam'=&gt;  ucfirst($ user-&gt; voornaam)。  ''。  ucfirst($ user-&gt; achternaam),
'id'=&gt;  $ user-&gt; id,
]; 
  code>  pre> 
 
 

使用视图: p>

 &lt; html&gt;  
&lt; body&gt; 
&lt; p&gt; 
&lt; b&gt; {{$ name}}&lt; / b&gt; 在****网站注册为注册会员。
&lt; / p&gt; 
 
&lt; / body&gt; 
&lt; / html&gt; 
  code>  pre> 
 
 

邮件不发送和执行Mail :: failures()返回: p>

  [
“secretaris @ ****。nl”,
] 
  code  >  pre> 
 
 

我不知道这些邮件功能之间有什么区别,以及为什么一个有效,另一个无效。 p>

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

我希望有人可以帮助我! p>

谢谢 p> div>

  • I suspect the error is in this line

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

  • Please check if you can sent out an email via this email through Laravel

no-reply@****.nl

  • Check to see if you configure it properly in .env file