jmhobbs/Swiftmailer-Transport--AWS-SES — Issue #12: Blank html email display
Author: armababy
Created: 2011-11-07 20:00:47+00:00
State: open

Hey,

First of all i not sure to what this is related to your transport or AWS SES itself, so please correct me if anyone know.

So after sending email i receive it in my email client (thunderbird to be exact). By default i have set to open emails in text/html so i open that new email and display part of body is empty (white space), subject and all other info is there. Also when you look source of email you can see that html part is there just not displaying. Also tested with Outlook 2010 - same outcome.

How i compose email:

$message = file_get_contents(INI_PATH.'/mail_templates/forgot_password_lv.html');

$message = str_replace('{password}', $password, $message);
$message = str_replace('{email}', $email, $message);

$transport = Swift_AWSTransport::newInstance(AWSAccessKeyId, AWSSecretKey);
$mailer = Swift_Mailer::newInstance($transport);

$comp_mail = Swift_Message::newInstance()
->setSubject('Jauna parole.')
->setFrom(self::$from)
->setTo($email)
->setBody($message, self::CONT1)
->addPart(strip_tags($message), self::CONT2)
->setReturnPath(self::AWSRET);

if(!$mailer->send($comp_mail, $failures)){
self::record_message_error(__LINE__, $failures, $email);
return Message_FallBack::send_smtp($comp_mail, $email);
}else{
return true;
}
self::CONT1 = 'text/html';
self::CONT2 = 'text/plain';

If i try to send same message with my SMTP swiftmailer fallback script(contains exactly same code only transport changes) i get html email displayed alright.

For now i switch to SMTP solution.
Just inform me if it's on AWS SES account and i'll address them.

Thank you.