KOHb
KOHb

Reputation: 425

Zend Framework 2, Zend_Mail: how to send email with both html and text parts?

$html = new MimePart($email->getBodyHtml());
$html->type = 'text/html';
    ...
$text = new MimePart($email->getBodyText());
$text->type = 'text/plain';
    ...
$mimeParts = array($html, $text);
    ...
$body->setParts($mimeParts);

This works fine, but the email I am getting contains both html and text parts - and I mean they are both shown.

Gmail shows HTML first, and then right there it shows the plain text part. Obviously, I would like only HTML part to be shown, with the text portion only used when HTML is not available in email client.

Cheers, Andrew

Upvotes: 4

Views: 3214

Answers (2)

Wandering Zombie
Wandering Zombie

Reputation: 1121

Rob Allen's DevNotes

Simple... when you know how!

Upvotes: 3

undefined
undefined

Reputation: 2101

The documentation mentions only http://framework.zend.com/manual/2.0/en/modules/zend.mail.introduction.html. No setParts method.

Upvotes: 0

Related Questions