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.
Currently, pm_email_notify passes the message body through drupal_html_to_text() before sending it as an email.
I understand why we wouldn't want to trust html in normal private messages (created by users through their browser).
However, some private messages might be created internally by custom code (such as during a custom cron job). Email notifications for these private messages should allow the html from the message body to pass through to the email.
The code change is simple. (see patch file)
After the change, you can do the following:
privatemsg_new_thread( , , , array('pm_email_notify_send_as_html' => TRUE))
Comment | File | Size | Author |
---|---|---|---|
#6 | 926884_email_tokens.patch | 3.87 KB | te-brian |
#4 | pm_email_notify.module.patch | 1017 bytes | codeglyph |
#1 | pm_email_notify.module.patch | 904 bytes | codeglyph |
pm_meail_notify-cbd-2010-09-29.patch | 1.07 KB | adamus_maximus | |
Comments
Comment #1
codeglyph CreditAttribution: codeglyph commentedGood job. But i think that isn't enough. The transformation
trim(check_markup($message['body'], $message['format'], FALSE))
that is applied to the body if the send_as_html flag is present will still clean all the html tags.Check the manual here: http://api.drupal.org/api/drupal/modules--filter--filter.module/function...
so i think performing only a 'trim' is the right way to do it.
Here's a patch based on yours that does that.
However i feel the running of the body through 2 functions (in the original version )is somewhat redundant.
'!pm_body' => trim(drupal_html_to_text(check_markup($message['body'], $message['format'], FALSE))),
Since check_markup has the ability to purge or escape the html and the drupal_html_to_text (http://api.drupal.org/api/drupal/includes--mail.inc/function/drupal_html...) function should provide viable alternatives for tags. In this case there's nothing to provide for since the tags are already cleaned by the first function.Comment #3
BerdirYou need to create the patch from the privatemsg main directory or the testbot can't apply your patch.
I'm not sure about the suggested solution but anyway, new features need to go into the 6.x-2.x branch.
Comment #4
codeglyph CreditAttribution: codeglyph commentedHere is the patch derived from 2x-dev.
Comment #6
te-brian CreditAttribution: te-brian commentedThis is a brand new patch that allows other modules to alter the e-mail tokens.
This would indirectly solve the OP's issue because he could change the body to be whatever he wants.
It will also allow other modules to add whatever tokens they please.
If there is still a desire to have this html e-mail option, feel free to move this patch to a new issue dedicated to just the token alter.
Comment #7
BerdirSame here, go testbot!
Interesting idea, I definitly like that more than the previous patch. Note that we are using real tokens in D7, I'm currently not sure if token replacements can be altered in D7 but the list certainly can be extended.
Comment #8
BerdirComment #9
te-brian CreditAttribution: te-brian commentedBump. Technically this patch does not directly address the OP's problem, but it provides a better facility for email token altering in general. If this were committed and we still desired a specific setting for html emails, it could be implemented via the alter.
Comment #10
BerdirCommited.
Comment #11
BenK CreditAttribution: BenK commentedSubscribing to help test D7 port
Comment #12
ivnish CreditAttribution: ivnish commented