Directus /mail endpoint removes html markup

444 Views Asked by At

I am working on an Vue/Directus(8.8.0) App that features a Messaging System which has the option to also send an Email containing the message.

I am using the Directus Javascript SDK with the method:

this._vm.$directus.api.post(state.endpoint, mailData, {} );

mailData contains the message body, subject and an array of recipients. The Message itself is written with vue-editor2 and contains html markup like:

<p><strong>bold text</strong></p>

My Problem is now when i use the /mail endpoint of directus to send the message with the method described above, most html tags get stripped and i end up with

<p>bold text</p>

in the Email Body.

Upon closer inspection, the values are saved fine in directus itself, all the formatting information is still there, only when sending the mail the tags are removed.

Directus uses Twig for the Email Templates. I have extended the base.twig template and made sure that the email body uses the "raw" parameter:

{% block content %}{{ body|raw }}{% endblock %}

I could not find any information in the docs on whats happening to the html when using the SDK with the /mail endpoint.

Does anyone know where the problem is?

0

There are 0 best solutions below