Support Forum

Advanced Search
Forum Scope


Forum Options

Minimum search word length is 3 characters - maximum search word length is 84 characters
Subscriptions and HTML emails plugin bug rendering content
Jonathan Blyer
Pro Subscribers
sp_UserOfflineSmall Offline
Apr 8, 2020 - 12:23 pm

Hello, I've found some conflicts between the the "subscriptions", "HTML emails" and "post by email" plugins.


First, links are not rendered correctly when sent via email by the subscriptions plugin.

There appear to be two things causing this. One is that When the email body is filtered/processed SP()->user->thisUser is empty. This will result in the permissions check failing and links will display "[Permission to view this link is denied]". Additionally, this same problem will cause links to video services (which gets converted to an iframe when displayed on the forum) to be displayed as "[Permission to view this media is denied]". I was able to work around this issue by always allowing links to be viewed (using a filter), and a filter to set the user properly before the email notification is sent out:

add_filter('sph_subscriptions_notification_email', function ($msg, $newpost, $userID, $type) {
    $userObj = SP()->user->get($userID);
    SP()->user->thisUser = $userObj;
    SP()->rewrites->pageData['forumid'] = $newPost->forumid;
}, 9, 4);
However, this leads me to the next issue. When the html emails plugin is creating the body of the email, the content is filtered using the SP()->displayFilters->content() filter. This will attempt to embed any links as an iFrame, which is not supported in email resulting in a broken email sent out.

On line 332 of sp-resouces/forum-plugins/html-email/library/sp-html-email-components.php the post content is included in the email, and filtered using the displayFilters->content() function. This call is using the $newpost['postcontent_unescaped'] field which will overwrite any modifications made by filters from previous functions. For example if I want to modify links before they are sent out via email in by using the filter sph_subscriptions_notification_email I cannot actually modify the post content because I do not have access to change $newpost['postcontent_unescaped'] that will be used by sp_html_email_do_subs_body.


Lastly, there is a problem parsing email content when using the post by email plugin (tested through gmail). Curly or smart quotes and double quotes appear incorrectly. I believe this is due to utf-8 encoding being used by gmail and simplepress is using ISO-8859-1 .

Please let me know how I can proceed with these issues, or if there is some workaround I can follow.

Any help is much appreciated!

Jonathan Blyer
Pro Subscribers
sp_UserOfflineSmall Offline
Apr 8, 2020 - 12:48 pm

One other thing I've found related to smart/curly quotes not rendering correctly. My assumption was correct in that it is a conflict between utf-8 and ISO-8859-1.

On line 82 of sp-email-post-imap.php in the function sp_process_inbox_imap the following is run:

$content = trim(utf8_encode(quoted_printable_decode($content)));

The call to utf8_encode here will cause the conflict since this function "Encodes an ISO-8859-1 string to UTF-8"

Unfortunately there are no filters or ability to modify this encoding. And the other two issues I mentioned are still a problem

Please let me know what should be done.


Jonathan Blyer
Pro Subscribers
sp_UserOfflineSmall Offline
Apr 29, 2020 - 7:58 am

Any insight into these issues?

Without links or proper rendering in emails we are inclined to turn off this feature... until it can be addressed...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 633
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 615
Members: 17337
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10105
Posts: 79544