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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pillarsdotnet’s picture

Status: Needs review » Postponed

I 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:

  1. text format (input) filter
  2. template
  3. (if enabled) theme
  4. (if enabled) output filter
  5. (if enabled) inline image attachment

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.

Dmitriy.trt’s picture

Maybe 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.

pillarsdotnet’s picture

Actually, it would be simpler to just enclose it in <pre> tags within a template.

Dmitriy.trt’s picture

And what about URLs and e-mail addresses? They will remain plain text if we just wrap in <pre> instead of pre-filtering.

pillarsdotnet’s picture

Not if you add an appropriate output-filter.

Dmitriy.trt’s picture

Ok, 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)

pillarsdotnet’s picture

Template can contain php code.

Dmitriy.trt’s picture

Ok, 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.

pillarsdotnet’s picture

Version: 6.x-2.56 » 6.x-2.x-dev
Assigned: Unassigned » pillarsdotnet
Category: feature » task
Priority: Normal » Minor
Status: Postponed » Fixed

Applied to -dev; will be included in next release. And thanks for feedback.

Status: Fixed » Closed (fixed)

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

B-Prod’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Closed (fixed) » Needs review
FileSize
3.88 KB

Here is a patch against current 7.x DEV version.

B-Prod’s picture

Patch 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.

Stephen_WTD’s picture

Issue summary: View changes

3 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?

B-Prod’s picture

You'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.

salvis’s picture

Well, if nobody cares enough to RTBC...

Utkarsh_Mishra’s picture

Status: Needs review » Needs work
salvis’s picture

Assigned: pillarsdotnet » Unassigned
salvis’s picture

Status: Needs work » Needs review

The last submitted patch, htmlmail-2.56-pre-filter.patch, failed testing. View results

The last submitted patch, 11: htmlmail-pre-filter-1184534-11.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 12: htmlmail-pre-filter-1184534-12.patch, failed testing. View results

salvis’s picture

Ok, so #12 needs a re-roll...

Utkarsh_Mishra’s picture

Assigned: Unassigned » Utkarsh_Mishra
Status: Needs work » Needs review
FileSize
4.65 KB
salvis’s picture

Version: 7.x-2.x-dev » 8.x-3.x-dev
Status: Needs review » Needs work

Thank 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?