2017-02-27 31 views
0

好吧,我目前正在使用Mandrill發送電子郵件。 我假設這是不是的問題。這個測試路線,例如火災罰款。Laravel 5.2身份驗證腳手架重置密碼電子郵件不燒 - 排隊?

public function email($emailAddress){ 
     $data = array(
      'email'  => $emailAddress, 
      'name'  => 'Test Name' 
      ); 
     $result = Mail::queue('emails.test', $data, function ($message) use ($data){ 
      $message->from(Config::get('settings.contact_form_from.address'), Config::get('settings.contact_form_from.name')); 
      $message->sender(Config::get('settings.contact_form_from.address'), Config::get('settings.contact_form_from.name')); 
      $message->to($data['email'], $data['name']); 
      $message->subject('Test email to: ' . $data['email']); 
     }); 
     return $this->response($result); 
    } 

這是使用queue函數。如果調整爲Mail::send()也工作正常。因此,我所有的隊列處理程序和郵件環境變量都工作正常。 (我可以在Mandrill看到這兩封電子郵件)。

所以我的問題是密碼重置功能,我已經安裝了使用Laravel 5.2 Auth腳手架。

所以,路線等一切正常 - 只是沒有電子郵件發送。

它正確識別用戶是否存在(顯示正確的錯誤信息)。

然後我看看源代碼,稍微有點迷路,需要幫助!

如果我在這裏看... ...Illuminate\Foundation\Auth\ResetPasswords.php我可以看到這種方法。

公共函數sendResetLinkEmail(請求$請求) { $這 - > validateSendResetLinkEmail($請求);

$broker = $this->getBroker(); 

$response = Password::broker($broker)->sendResetLink(
    $this->getSendResetLinkEmailCredentials($request), 
    $this->resetEmailBuilder() 
); 
switch ($response) { 
    case Password::RESET_LINK_SENT: 
     return $this->getSendResetLinkEmailSuccessResponse($response); 
    case Password::INVALID_USER: 
    default: 
     return $this->getSendResetLinkEmailFailureResponse($response); 
} 

}

如果我在$response打破我得到的響應,它被正確發送。所以我認爲這與Password::broker部分有關,這裏的代碼完全讓我失望。

任何幫助非常感謝!

回答

1

您是否有來自config/mail.php的電子郵件設置的默認設置?

'from' => [ 
    'address' => '[email protected]', 
    'name' => 'My site', 
], 

而這個域是在你的Mandrill列入白名單的域名?

+0

謝謝!我看了很多東西,甚至沒有看到這個!它被設置爲空,希望它拋出一個錯誤! –

相關問題