This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

mesinrusak
mesinrusak

In document says that:

Note: Basic Twig tags and expressions are supported in mail views.

I think right now is not enough when you try parsing multiple data with basic twig tags only.

as happened to me, i want to send email from checkout with many list of products with quantity and price (dynamic data). I am confused how to send it.

I try to add all data in 1 tag using html code, unfortunately twig tags in mail views cannot apply the escape filter. example: {{ data|e('html') }}.

I think it would be an interesting feature when twig tags same as the content.

Or maybe someone has an idea for adding complex/looping data for mail views?

Last updated

Keios
Keios

I am also interested if there is a way to make Twig act like in CMS, ie.: object property access with dots (doesn't work), loops and raw filters.

pikusfikus
mesinrusak
mesinrusak

Finally, I found the solution. It's quite simple, actually

Edit file fields.yaml in modules\system\models\mailtemplate\

Change

        content_html:
            type: richeditor
            size: huge
            tab: system::lang.mail_templates.content_html

Become

        content_html:
            type: codeeditor
            size: huge
            tab: system::lang.mail_templates.content_html
            language: html

Now you can add twig syntax like {%for row in data %} , etc.

Last updated

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.