Unfortunately the MIME package's use of Multipart/Alternative for the content type results in an unreadable message (due to an unknown content-type).

With D6 core and an html message delivered with both HTML and plain text, the Content-Type header starts out as

Content-Type: multipart/alternative;\nboundary="=_0828cbc3f5cb213da94e02f967b1c7f4"

However, Drupal's drupal_mail_send() does this to it:

    $mimeheaders = array();
    foreach ($message['headers'] as $name => $value) {
      $mimeheaders[] = $name .': '. mime_header_encode($value);
    }

resulting in a header like this:

Content-Type: =?UTF-8?B?bXVsdGlwYXJ0L2FsdGVybmF0aXZlOwogYm91bmRhcnk9Ij1fZGNmMTFmZmZmMzc=?=
 =?UTF-8?B?MjRjYjYwZDMyZWQ0MGQyMGI3NDE2Ig==?=

Which ends up being a mimetype which no mail client can understand, so you have an email that looks like this:

The attached patch attempts to undo this damage by just removing the \n for a far more normal Content-Type header. This is kind of hacky, but without changing PEAR's Mail/Mime.php I don't know what would be a reasonable alternative.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

What email looks like without this patch:

rfay_screenshot 2012-10-15 at 12.46.10 PM.png

salvis’s picture

Is this D6-only or does it apply to D7 as well?

salvis’s picture

I would really like to create new releases for Mail MIME, but we have three patches in the queue that should probably be committed:

#1813542: Multipart/Alternative with line break (introduced by PEAR) breaks drupal core and results in unreadable message (D6 — what about D7???)
#1929678: Mail MIME inline images using image_style's do not work with Drupal 7.20 (D7, maybe D6, too)
#1935610: url_to_realpath fix (D7, maybe D6, too)

I'm not using Mail MIME myself, and I need someone to review these patches. Maybe the three authors could trade reviews? Or someone else who is actively using Mail MIME?

DuaelFr’s picture

This patch applies on D7 but seems not needed as the described behavior does not happens on a vanilla install.

salvis’s picture

Status: Needs review » Fixed

Committed to 6.x-2.x-dev.

Thank you for unblocking us, DuaelFr!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.