Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Our htmlmail.tpl.php template starts like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php print $subject; ?></title>
</head>
<body>
And ends like this:
</body>
</html>
HOWEVER, we don't get any of those 7 lines of code and the end is just </html>
no closing body tag. We made our own EMAIL input format with only these filters enabled:
Transliteration
Emogrifier
Correct URLs with Pathologic
Comments
Comment #0.0
drubage CreditAttribution: drubage commentedupdated to use code tags
Comment #1
pillarsdotnet CreditAttribution: pillarsdotnet commentedEmogrifier shouldn't be used on input; only on output.
Comment #2
drubage CreditAttribution: drubage commentedWord up, thank you!
Comment #3
drubage CreditAttribution: drubage commentedComment #4
jwilson3I dont understand how this works as designed.
The HTML Mail *tells* us specifically to use an input format to filter emails *after* theming, and specifically suggests using Emogrifier. When enabled, emogrifier strips doctype, html, head, body tags, as well as any tags inside the head section (eg styles, meta). When disabled, it works as it should, however, you completely lose the emogrification, and thus lose cross-client visual consistency.
This is still a valid bug, unless someone can explain where to add emogrifier into the mix.
Comment #5
pillarsdotnet CreditAttribution: pillarsdotnet commentedTry reading the documentation?
Comment #6
jwilson3I have read the documentation, quoting it here:
We do not want to use the Echo module, which would require building an entire theme to wrap the email in a simple email template file. Thus, we've placed all the html from
<doctype>
to</html>
into the htmlmail.tpl.php file, and built a custom text format for post template filtering, and have added the emogrifier filter, the line-break filter, and the Correct URLs with Pathologic filter. In a configuration very similar to what is recommended in the screenshot linked from documentation ([44]
above). We set this filter in *part 3* on the HTML Mail configuration screen (Post-filtering). When the emails are sent, the elements in the OP get stripped.I dont know what I'm doing wrong here. Any help or suggestions beyond just RTFM would be very welcome. Thanks! :)
Comment #7
jwilson3To shorten things down, you say "dont use emogrifier on input only output". We'll my response is, we are not using emogrifier on input, we have it properly configured to run *after* theming, as HTML Mail requires, and it *still* strips the code above.
Its possible I'm getting lost in translation of what you mean by input versus output, but i could find no other place to specify what format to use than the Post-filtering format on the HTML Mail config screen.
I stand by my statement that this still seems like a bug. Is anything else relevant to help trouble shoot this issue?
Comment #8
pillarsdotnet CreditAttribution: pillarsdotnet commentedWill look into when I get a chance.
Comment #9
tchopshop CreditAttribution: tchopshop commentedhaving the same trouble... even without emogrifier enabled as a post filter, the html and body tags are being stripped and replaced by
<p>
tags.Comment #10
jwilson3@tchopshop, your post got munged; try wrapping code samples in <code> </code>
Comment #11
jwilson3Also, this issue is specific to the Emogrifier integration. If you're having issues with other configuration that is not related to the presence of the Emogrifier, please file a separate issue.
Comment #12
tchopshop CreditAttribution: tchopshop commentedSorry, I am having a lot of trouble with emogrifier-- I've tried everything, nothing has worked. But I think the p tag issue is related to the wysiwyg filter that I must use also.
I wrote up my woes here (on the Emogrifier issue queue):
http://drupal.org/node/1336106
Comment #13
John Franklin CreditAttribution: John Franklin commentedThis can be closed as a duplicate of #1842946: Modify HTML code only by the Emogrifier library.
Comment #13.0
John Franklin CreditAttribution: John Franklin commentedcode updates
Comment #14
jacob.embree CreditAttribution: jacob.embree commentedAs suggested in #13, closed as a duplicate.