No Code Attached Yet bug
avatar ManuelHu
ManuelHu
12 Feb 2023

Also described by @ReLater in #39774 (comment). This is an additional issue, that is significantly older (i suppose since the introduction of mail templates)

Steps to reproduce the issue

  • Install joomla 4.2.6 or 4.2.7 with #39850 applied
  • Make sure action logs for user events are enabled and configure working system email sending
  • In the user settings for a user with a valid email address (you can receive mail on), enable user action information emails for the user component.
  • Log out and log back in
  • Look at the emails you should have received

Expected result

Plain text mails do not contain HTML links

Actual result

Plain text mails do contain HTML links, which renders weird in some mail clients

System information (as much as possible)

  • joomla 4.2.7 on PHP 8.1
  • Mail clients: e.g. Thunderbird, but also others

Additional comments

This appears to be a regression from the introduction of MailTemplates in Joomla 4.x and is working in 3.10.x

  • All (default) mail templates are plain text in 4.2
  • In 3.10.x, user information mails are rendered via the "normal" layout way - always producing HTML mails: administrator/components/com_actionlogs/models/actionlog.php#L167
  • The data passed to the template did not change significantly between 3.10.x and 4.x, and still contains HTML markup in the bound values

This is a problematic situation, as the new mail templates also support HTML mails (that are disabled by default?), but there is no way to differentiate the values passed to the template. All simple fixes will lead to either the HTML emails losing the links, or to the plain text mails having HTML markup in them.

avatar ManuelHu ManuelHu - open - 12 Feb 2023
avatar joomla-cms-bot joomla-cms-bot - change - 12 Feb 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Feb 2023
avatar ManuelHu ManuelHu - change - 12 Feb 2023
Title
[4.2] User Action Information emails do not
[4.2] User Action Information emails do contain HTML links in plain text emails
avatar ManuelHu ManuelHu - edited - 12 Feb 2023
avatar ManuelHu
ManuelHu - comment - 18 Feb 2023

I have thought about different ways to implement this nicely.

  1. apply strip_tags on all replaced values. This is rather bad, as php's strip_tags does not know what a tag is and removes anything between < and >, possibly removing valid and intended data. -> NOT A SOLUTION
  2. add some sort of suffixes to template tags - so that {USERNAME#strip_html} will apply the function onto the value (for now only for a strip_tags wrapper, but this could be extended in the future)
  3. Add a separate parameter array that will be used for the plain text template mode. This should be merged with the default/HTML array before applying it, to gracefully fall back if the caller does not specify extra text-mode data

Both options 2 and 3 should be viable in a technical sense, and could be used to solve this issue.

avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023
avatar ManuelHu
ManuelHu - comment - 5 Mar 2023

I have implemented strategy "3" in #40033. Please only close this issue after the strategy is approved and not scrapped :-)

avatar Quy Quy - change - 5 Jan 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-01-05 17:14:53
Closed_By Quy
avatar Quy Quy - close - 5 Jan 2024
avatar Quy
Quy - comment - 5 Jan 2024

Closing as PR is merged. Thank you.

Add a Comment

Login with GitHub to post a comment