HTML emails do not work

Created on 13 September 2023, about 1 year ago
Updated 11 June 2024, 5 months ago

Problem/Motivation

When trying to send html emails, they always come through with the html escaped. I'll attach my current patch for this issue.

Steps to reproduce

- Enable the PF Email module.
- Setup ECA (or any other system) that will trigger an email through Push Framework
- Go to /admin/config/system/push_framework and set the text format to an HTML enabled format.
- Trigger the action setup above.

πŸ› Bug report
Status

Active

Version

2.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States j_ten_man

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @j_ten_man
  • πŸ‡ΊπŸ‡ΈUnited States j_ten_man

    Patch attached.

    The issue stems from the fact that the ChannelPostRender event casts the $output variable to a string, so we lose the Markup class on it.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Great finding @j_ten_man, thanks for reporting this. Wouldn't it be better, to avoid casting in the first place? I mean, we could update the ChannelPostRender event such that the output variable accepts either string or Markup so that we never even loose context. What do you think?

    When we continue working on this, please turn this into an issue fork with a merge request. Patches will no longer work soon, so we've already changed workflow to MRs, which is much more convenient for development, review and everything else.

  • πŸ‡ΊπŸ‡ΈUnited States j_ten_man

    Potentially that's a better solution - it allows other event subscribers to correctly handle the text that way. I wasn't sure of other unintended consequences of doing it that way as it would potentially be an API change, and this solution was good enough for my needs.

  • Assigned to Thomas Bosviel
  • Pipeline finished with Failed
    6 months ago
    Total: 144s
    #193552
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Not sure, if this is already ready for review, since the issue status doesn't indicate that yet. But from what I can see in the MR so far, I wouldn't remove the string type, instead we should declare string|MarkupInterface as the possible types for output, as this is as strict as we can get in this case. And I love strict types ;-)

Production build 0.71.5 2024