If you are using composeFromKey() method and html template for emails then it will not work as expected.
For some reason function will ignore html template with .twig extension and it will ignore template with extends tag and it if you'll use user.dateUpdated tag without date format like user.dateUpdated | date("F jS \\a\\t g:ia"). But it will ignore these just for newly created email key. It will work for system email key like forgot_password
To reproduce
Steps to reproduce the behaviour:
Go to "/admin/settings/email"
Set html template path
Create custom function to send system email with custom key like:
{% if currentSite.language == 'de' %}
{% include '_emails/user_custom_case_de' %}
{% elseif currentSite.language == 'es' %}
{% include '_emails/user_custom_case_es' %}
{% elseif currentSite.language == 'sv' %}
{% include '_emails/user_custom_case_sv' %}
{% endif %}
{% endif %}
{% endblock %}
{# user_custom_case_de.twig #}
Hello
Date: {{ user.dateUpdated }}
### Expected behaviour
Email should use html/twig template according to email key and language. But now it show text from the language file accoording `body` variable `'body' => Craft::t('app', 'user_custom_case_body')`
### Versions
- Craft version: 3.5.17.1
Describe the bug
If you are using
composeFromKey()
method and html template for emails then it will not work as expected. For some reason function will ignore html template with.twig
extension and it will ignore template withextends
tag and it if you'll useuser.dateUpdated
tag without date format likeuser.dateUpdated | date("F jS \\a\\t g:ia")
. But it will ignore these just for newly created email key. It will work for system email key likeforgot_password
To reproduce
Steps to reproduce the behaviour:
{% block content %}
{% if emailKey == 'account_activation' %}
{% endif %}
{% endblock %}
{# user_custom_case_de.twig #}
Hello
Date: {{ user.dateUpdated }}