I configured my postfix to use Amazon SES when sending Emails.
I am trying to use FOSUserBundle’s function to send email for user password reset.
Unfortunately, the mail never arrive to the mailbox, Amazon SES don’t accept the emails forged by the FOSUserBundle.
Does anybody what is the matter with this email:
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: <1350274076.507b8c1c8cee8@www.yourownpoet.com>
From: quilly@YourOwnPoet.com
Subject: blablou
To: toto@gmail.com
Bcc:
<html><body>whatever</body></html>
This doesn’t work neither:
Content-Type: multipart/alternative;
boundary="_=_swift_v4_1350274671507b8e6f82b5f_=_"
MIME-Version: 1.0
Date: Mon, 15 Oct 2012 04:17:51 +0000
Message-ID: <1350274671.507b8e6f99894@www.yourownpoet.com>
From: quilly@YourOwnPoet.com
Subject: blablou
To: toto@gmail.com
Bcc:
<html><body>whatever</body></html>
I created my own mailer service in order to try the emails with different headers (I use SwiftMailer). How should I forge my email so that it goes through Amazon SES?
EDIT:
I noticed that other mail with content-type: multipart/mixed; go through SES, but I don’t manage to force the content-type field to this value. Is it possible to do it? Here is how i forge the email:
$message = \Swift_Message::newInstance()
->setContentType('multipart/mixed')
->setSubject('blablou')
->setFrom('quilly@YourOwnPoet.com')
->setTo('toto@gmail.com')
->setBody('<html><body>whatever</body></html>', 'text/html')
->addPart('fdsfsd', 'text/plain');
$this->mailer->send($message);
But the content-type is still ‘multipart/alternative’..
Allright, found the answer… Leaving the post here, who knows might be useful to someone one day.
The problem wasn’t coming from the content-type but from the sender’s email adress!
Remember that you have to set which email addresses have the right to send email through ses.. And this email is case sensitive!
You can use the Mailer provided by FOSserBundle without problem, but configure it properly:
config.yml: