2016-03-27 33 views
0

我:SES電子郵件未驗證的 「到」 字段中Laravel

Mail::send('emails.booking-confirmation', [ 
     'name' => $name, 
     'email' => $email, 
     'tel' => $tel, 
     'msg' => $msg, 
     'date' => Carbon::parse($date)->format('l, jS \o\f F, Y \a\t H:ia'), 
     'service' => $q->service, 
     'duration' => $q->duration . ' minutes' 
    ], function ($m) use ($name, $email) { 
     $m->from('[email protected]', 'Subject'); 
     $m->to($email, $name)->subject('Your Booking'); 
    }); 

當使用AWS SES發送我得到:

Error executing "SendRawEmail" on "https://email.eu-west-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://email.eu-west-1.amazonaws.com` resulted in a `400 Bad Request` response: 
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> 
<Error> 
<Type>Sender</Type> 
<Code>MessageReje (truncated...) 
MessageRejected (client): Email address is not verified. - <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> 
<Error> 
<Type>Sender</Type> 
<Code>MessageRejected</Code> 
<Message>Email address is not verified.</Message> 
</Error> 
<RequestId>8551cf11-f420-11e5-b4ac-bf30e6ff71ee</RequestId> 
</ErrorResponse> 

我的地址和域名進行驗證。

如果我做的:

... 
], function ($m) use ($name, $email) { 
     $m->from('[email protected]', 'Subject'); 
     $m->to('[email protected]', $name)->subject('Your Booking'); 
    }); 

它完美,而是完全無用。

如何獲得這項工作,以便我可以發送電子郵件給填寫我的表單的用戶?

+0

出於興趣,什麼是後續代碼var_dump($電子郵件)的'輸出; die()'在$ m->之前($ email,$ name) - > subject('Your Booking');'? – Chris

+0

@Chris string'[email protected]'(length = 18) – imperium2335

+0

我只是在這裏發聲 - 但是如果你手動複製粘貼,就像你的第二個例子:$ m-> to('users @ email.com',$ name) - >主題('您的預訂');那樣有用嗎? – Chris

回答

6

這是抱怨你的To: email地址未驗證。看起來你在SES Sandbox模式。在您將SES帳戶更改爲production帳戶之前,您必須先驗證您的Sender電子郵件地址。

當您同時測試FromTo是您的電子郵件地址(已經過驗證)。

來源:Verifying Email Addresses in Amazon SES

直到您的帳戶是衝出亞馬遜SES沙盒,你還必須 驗證每個收件人的電子郵件地址,除了由亞馬遜SES郵箱模擬器提供的收件人 。有關郵箱模擬器的更多信息 ,請參閱測試Amazon SES電子郵件發送。有關 有關移出沙箱的更多信息,請參閱Amazon SES Sandbox中的移出 。

Moving Out of the Amazon SES Sandbox