2012-10-15 99 views
1

我配置我的後綴發送電子郵件時使用亞馬遜SES。 我正嘗試使用FOSUserBundle的函數發送用戶密碼重置的電子郵件。 不幸的是,郵件從未到達郵箱,Amazon SES不接受FOSUserBundle僞造的郵件。集成FOSUserBundle重置電子郵件與亞馬遜SES

有誰有什麼與此電子郵件事項:

Content-Type: multipart/alternative; 
boundary="_=_swift_v4_1350274671507b8e6f82b5f_=_" 
MIME-Version: 1.0 
Date: Mon, 15 Oct 2012 04:17:51 +0000 
Message-ID: <[email protected]> 
From: [email protected] 
Subject: blablou 
To: [email protected] 
Bcc: 
    <html><body>whatever</body></html> 

我爲了嘗試不同的標題的電子郵件,創建了自己的郵件服務:

Content-Transfer-Encoding: quoted-printable 
Content-Type: text/html; charset=utf-8 
MIME-Version: 1.0 
Date: Mon, 15 Oct 2012 04:07:56 +0000 
Message-ID: <[email protected]> 
From: [email protected] 
Subject: blablou 
To: [email protected] 
Bcc: 
    <html><body>whatever</body></html> 

這不起作用既不(我使用SwiftMailer)。我應該如何僞造我的電子郵件以便通過Amazon SES?

編輯:

我注意到,其他與郵件內容類型:多部分/混合;通過SES,但我沒有設法強制內容類型的字段這個值。可以做到嗎?這裏是我僞造的電子郵件:

$message = \Swift_Message::newInstance() 
     ->setContentType('multipart/mixed') 
     ->setSubject('blablou') 
     ->setFrom('[email protected]') 
     ->setTo('[email protected]') 
     ->setBody('<html><body>whatever</body></html>', 'text/html') 
     ->addPart('fdsfsd', 'text/plain'); 

$this->mailer->send($message); 

但內容類型仍然是「multipart/alternative的」 ..

回答

2

還好吧,找到了答案...離開這裏後,誰知道可能是有一天對某人有用。

問題不是來自內容類型,而是來自發件人的電子郵件地址! 請記住,您必須設置哪些電子郵件地址有權通過ses發送電子郵件。此電子郵件區分大小寫!

可以使用沒有問題由FOSserBundle提供的梅勒,但適當的配置:

config.yml:

fos_user 
    resetting: 
     email: 
      template: YOPYourOwnPoetBundle:Emails:resetEmail.html.twig 
    from_email: 
     address:  [email protected] /*set ses accepted email address here */ 
     sender_name: Quilly 
    service: 
     mailer: fos_user.mailer.twig_swift 
+0

如果你可以驗證整個域通過amazonses發 – Sergey