Multi-paragraph text injected through token

Your software
My Mautic version is: 4.4.10
My PHP version is: 8.0.30
My Database type and version is: MariaDB - 10.6.16

Your problem
My problem is:
I need to inject multi-paragraph content into an email template. The number of paragraphs can vary, and therefore I can’t create one token for each paragraph, in the builder, as that would require that I know beforehand how many paragraphs there will be.

PS: to whatever extent this matters, I want to send these emails programmatically, by using the API’s send email endpoint. I am only mentioning this because I am starting to get the impression that tokens are handled slightly differently when sending through the API, but I might be wrong here.

Steps I have tried to fix the problem:

  • Newlines get ignored when the mail is rendered as HTML
  • The string that gets inserted into the token is HTML escaped by default, so adding tags doesn’t help, as they will just show up as raw text
  • In a desperate attempt, I’ve even tried sending an array of strings, but that doesn’t work either, it gets turned into the string “Array”

I have searched around, and in some places it is implied that HTML content should be supported, but I haven’t managed to get it to work. In other discussions that I have found, it is implied that this is not a supported feature (yet?). I am a bit confused. Is there any way I can achieve what I want?

1 Like

Is “some places” the mautic documentation? Please add an issue in github then. If not, there is a chance that its not supported yet. So this might then be a feature request (its a category in the forum.

I will try in the next days myself, as we also focus heavily on using the API.

The mautic documentation hints that HTML is supported, but is not completely clear if this applies to custom tokens. I mostly meant these forums, when I wrote “some places”.