Multipart email with swift

php, swiftmailer

Solution

You need to do:

$message->setBody($your_plain_text_email_here);
$message->addPart($your_html_email_here, 'text/html');

I just had the exact same question and this worked for me on the Mac mail app, iPhone mail app and Horde (webmail, it came up as plain text.)

Problem

Multipart messages are not being correctly shown on gmail when on the iPhone. I have: ``` $message->setBody($this->body, 'text/html'); $message->addPart($this->text_body, 'plain/text'); ``` I have also used: ``` $message->addPart($this->body, 'text/html'); $message->addPart($this->text_body, 'plain/text'); ``` But in both cases, when reading gmail from the iPhone I get the message as a 'MIME-attachment'... No html and the MIME-attachment cannot even be read. The message will display fine if I don't add the text part... Any ideas?

Original source