The following commit breaks the order confirmations sent out by ubercart.
http://drupalcode.org/project/htmlmail.git/commitdiff/e80afff44d3809ab72...

Ubercart 7.x-3.0, HTML Mail 7.x-2.65, Mail System 7.x-2.34, Rules 7.x-2.1

When reverting this change the order confirmations looks normal again.
The broken order confirmations have *a lot* of < br / >:s after every row, creating a lot of whitespace that isn't supposed to be there.
It seems like every newline in the template are converted to a < br / >.

However, this only happens for the order confirmation sent out by rules. If I select to email a order confirmation in the Ubercart Store configuration it looks good.

I use the following patch to revert the change that breaks the template:

--- a/www/sites/all/modules/htmlmail/htmlmail.mail.inc
+++ b/www/sites/all/modules/htmlmail/htmlmail.mail.inc
@@ -46,7 +46,7 @@ class HTMLMailSystem implements MailSystemInterface {
     }
     else {
       if (is_array($message['body'])) {
-        $message['body'] = implode("<br />$eol<br />$eol", $message['body']);
+        $message['body'] = implode("$eol$eol", $message['body']);
       }
       $body = theme('htmlmail', $message);
       if ($message['body'] && !$body) {
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johan.wilfer’s picture

Issue summary: View changes

-

johan.wilfer’s picture

Issue summary: View changes

-

pillarsdotnet’s picture

So you want htmlmail to assume that if the message body is an array, the individual array elements are plaintext and not html.

generalredneck’s picture

This affects more than just Ubercart. I consider this a bug because we are using the "Unfiltered" Post-filtering and this code is adding breaks to our unfiltered html. We made the assumption that Unfiltered meant "Unfiltered Html" as well.

Unless I'm misunderstanding the usage of building templates for HTML mail, adding breaks on unfiltered mail seems wrong. See a screenshot of the results.

Also, I need to revert this line, but I need the patch in a file, so that's attached as well.

dieuwe’s picture

Patch works for me. Thanks :)

dieuwe’s picture

Status: Active » Reviewed & tested by the community
generalredneck’s picture

Thanks, dieuwe. I always forget to put the dang status into needs review :P

pillarsdotnet’s picture

Title: Upgrading htmlmail breaks email templates for ubercart 3 » Remove forced line breaks between message array elements.
Assigned: Unassigned » pillarsdotnet

Working on this...

pillarsdotnet’s picture

Status: Reviewed & tested by the community » Fixed

Committed; will be included in next release.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

-