2016-01-06 38 views
0

對於這個網站,我有一個接觸的形式,它只是發送了一封郵件是這樣的:Laravel郵件工程之一,但不是還有其他

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

的$輸入變量很簡單:

$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('[email protected]****.nl', 'No-Reply ****'); 
    $m->to('[email protected]****.nl', 'Secretaris ****')->subject('Registration of ' . ucfirst(Input::get('firstname')) . ' as Register-member'); 
}); 

的$數據這裏值爲:

$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 ::失敗()返回:

[ 
"[email protected]****.nl", 
] 

我不看看這些郵件功能有什麼區別,爲什麼一個工作,另一個不工作。

出於保護隱私的原因,我與****

我希望有人能幫助我,標誌着網站名稱!

感謝

+0

什麼郵件驅動程序是您使用正確的配置呢? –

+0

您要發送的數據是'naam',但在視圖中,您需要放置'$ name'。 –

+0

沒錯,我翻譯了它,但忘了翻譯它。這在我的代碼中是一樣的(naam和$ naam) –

回答

1
  • 我懷疑的錯誤是在這一行

$m->from('[email protected]****.nl', 'No-Reply ****');

  • 請檢查您是否可以通過Laravel
通過此郵件發送出去的電子郵件

[email protected]****.nl

  • 檢查,看看是否在.env文件
+0

這解決了我的問題!你試圖發送的電子郵件需要存在嗎?因爲服務器上沒有回覆。反正我用[email protected]****.nl工作得很好。 –

相關問題