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.
Attached patch implements pre-filtering message body after concatenation but before applying template. Of course, we could use template for this, but with growing number of templates there will be too much of repeated code, so I've added one more step to settings.
Other changes:
- Made word "Unfiltered" translatable
- Renamed fieldsets on settings page to meaningful names (titles are the same, changes are only in code).
Patch was made from 6.x-2.56.
Comment | File | Size | Author |
---|---|---|---|
#23 | htmlmail-pre-filter-1184534-23.patch | 4.65 KB | Utkarsh_Mishra |
| |||
#12 | htmlmail-pre-filter-1184534-12.patch | 4.69 KB | B-Prod |
#11 | htmlmail-pre-filter-1184534-11.patch | 3.88 KB | B-Prod |
htmlmail-2.56-pre-filter.patch | 4.72 KB | Dmitriy.trt | |
Comments
Comment #1
pillarsdotnet CreditAttribution: pillarsdotnet commentedI had this feature in an earlier version but removed it because input already gets pre-filtered by the chosen text input filter.
In other words, current code has the following filter chain:
I'm going to defer this in favor of something like Mailwire.
I do like your other code changes, and will probably incorporate them into the next release.
Comment #2
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedMaybe I'm missing something, but how can we apply pre-filter to "reset password" e-mail and many others sent by user module? For example, we want to convert newlines to P and BR tags, so e-mail wouldn't look like one big piece of text.
Comment #3
pillarsdotnet CreditAttribution: pillarsdotnet commentedActually, it would be simpler to just enclose it in
<pre>
tags within a template.Comment #4
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedAnd what about URLs and e-mail addresses? They will remain plain text if we just wrap in
<pre>
instead of pre-filtering.Comment #5
pillarsdotnet CreditAttribution: pillarsdotnet commentedNot if you add an appropriate output-filter.
Comment #6
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedOk, another simple example. Message body already contains HTML, you want to filter out images, but your template contains images too and you want to keep them. How can it be achieved without pre-filter? (Replace "images" with your favorite tag)
Comment #7
pillarsdotnet CreditAttribution: pillarsdotnet commentedTemplate can contain php code.
Comment #8
Dmitriy.trt CreditAttribution: Dmitriy.trt commentedOk, I give up, will use template for that. Please, close this feature request after minor changes will be committed (if you're still interested, of course).
And thanks again for good module and such a fast release cycle.
Comment #9
pillarsdotnet CreditAttribution: pillarsdotnet commentedApplied to -dev; will be included in next release. And thanks for feedback.
Comment #11
B-Prod CreditAttribution: B-Prod commentedHere is a patch against current 7.x DEV version.
Comment #12
B-Prod CreditAttribution: B-Prod commentedPatch below also add a checkbox in admin UI to avoid extra body message process by HTML mail module, in order to advanced pre-filter to work.
Comment #13
Stephen_WTD CreditAttribution: Stephen_WTD commented3 years later but thanks B-Prod your patch works. I am theming the system mail and post filtering was destroying my mail code - I tried using
<pre>
tags but that didnt work. I'm sure this is not the best way to do it but I wonder what everyone else does without using Echo?Comment #14
B-Prod CreditAttribution: B-Prod commentedYou're welcome. Actually I do not use anymore HTML Mail, because issue queue is too much sleeping.
You could try the Swift Mailer project which is, in my opinion, a very good alternative to HTML Mail or Mime Mail. It has less advanced features but you can easily go further with few lines of code.
Comment #15
salvisWell, if nobody cares enough to RTBC...
Comment #16
Utkarsh_Mishra CreditAttribution: Utkarsh_Mishra at OpenSense Labs for DrupalFit commentedComment #17
salvisComment #18
salvisComment #22
salvisOk, so #12 needs a re-roll...
Comment #23
Utkarsh_Mishra CreditAttribution: Utkarsh_Mishra at OpenSense Labs for DrupalFit commentedComment #24
salvisThank you, Utkarsh_Mishra.
D8 must go first, we should not have an upgrade path that removes features.
@RenatoG and @emartoni: Do we want to have this in D8?