I'm using MimeMail for the templates in formatting HTML. When I send with MimeMailSystem as the formatter, and MandrillMailSystem as the sender, I get a bunch of plain text above the HTML. This displays in gmail and Sparrow email clients.

This is a multi-part message in MIME format. --0c357c3f4f2b241d43f01fe7facc68e0 Content-Type: multipart/alternative; boundary="bdda76973244ccc5d620a938033e1503" Content-Transfer-Encoding: 8bit --bdda76973244ccc5d620a938033e1503 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit ** email body here ** --bdda76973244ccc5d620a938033e1503 Content-Type: text/html; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8Bit 

Note that Mandrill & MimeMail are configured with a Full HTML input format. (Although I think that only matters for MimeMail since that is the formatter)

My work-around is to configure Mail System to use SMTP (project: smtp configured with Mandrill's SMTP settings) to send. i.e. MimeMailSystem_SmtpMailSystem

Using SMTP displays the HTML as I expect to see it.

Comments

mmilano’s picture

Issue summary: View changes

more info

ptmkenny’s picture

I have the same issue with Mandrill 1.2, Mimemail 1.0-alpha2, and Mailsystem 2.34. I also tested with the latest dev version of Mimemail (2012-Oct-24), but no luck.

I can send my e-mails with my mimemail template using the SMTP module or PHPMailer and it works correctly (no junk text is displayed). However, e-mails sent by the Mandrill module include the extra text.

ptmkenny’s picture

Version: 7.x-1.2 » 7.x-1.4

I just confirmed that this is still an issue in the latest version:
Mandrill 1.4
Mimemail 1.0-alpha2
Mailsystem 2.34

bkonetzny’s picture

I could imagine this happens because of double formatting of the content. Even if you use MimeMailSystem for formatting and MandrillMailSystem for mailing, MandrillMailSystem still has the following code in mail() which I think should be moved to format():

    // Apply input format to body.
    $html = $message['body'];
    $format = variable_get('mandrill_filter_format', '');
    if (!empty($format)) {
      $html = check_markup($message['body'], $format);
    }
luksak’s picture

Facing the same issue. Uncommenting the lines mentioned in #3 does not work. How can we fix this? What is the issue exactly? Dont know too much about multi-part emails...

smaz’s picture

I spent quite a bit of time looking into this for a recent project, and I don't believe it's going to be possible to fix.

The short version is, mimemail provides the email in a multipart format, ready to be broadcast. This is then passed to the mandrill module, which uses that multipart formatted message as just the HTML content for the email. This is then passed over to the mandrill service, which takes care of multipart formatting - hence getting the double wrapping of multi part info & causing the issue.

I've just checked the API, and it looks like Mandrill doesn't support being handed pre-prepared mutlipart emails - it expects to be given the text and/or html versions of the email. So the only fixes are:

1) mimemail module allows for only the HTML to be prepared, not the full multipart encoding. This would allow other modules/services to produce the multipart formatting - in this case, the mandrill app but there could be other uses.
2) This module provides a method of including CSS in the email - out of scope of this module I think (and extremely hard to do).

smaz’s picture

Issue summary: View changes

more info

gcb’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

Thanks for the diagnostic work @smaz. If someone has an elegant suggestion on how to resolve it, please post a feature request (or re-open this ticket as a feature request).

antiorario’s picture

I just opened a feature request containing a patch that should solve this issue: #2450453: Allow theming of HTML messages (without using Mime Mail).