E-mail template limitations

Hello,

At the moment we’re using the Change Password e-mail template in Auth0 with a bunch of (Liquid syntax) if-then-else-s to accomodate for e-mails that need to be send for different apps (defined as separate applications in Auth0, therefor having different clientIds).

Since a particular e-mail template can grow quite large with all the HTML and CSS required for different e-mail clients (G-mail, Outlook, whatever), this single template is also getting quite big.

So, let’s say we have three different public web apps (and therefor 3 applications defined in Auth0), our template consists of 3 concatenated HTML templates with some if-then-else structures where it shows or hides sections based on the clientId.

Two questions arise:

  • What would be the limitation of the e-mail template? Is there a maximum number of characters the template is allowed to have?
  • Would there be a possibility to split it up somehow across different templates or do we need to move away from using these templates and start using an external e-mail service (like Mandrill) to use their templating engine?

Kind regards,

Emiel

Hi @emiel,

We don’t have a published maximum char limit, and I know some of our customers have very large templates. What you are describing sounds completely feasible.

We don’t have a feature like this at the moment.

You can always create a Feature Request, thanks!

Thanks for your prompt answer @dan.woda .

Could you perhaps also point me in the right direction what would be needed to move away from using Templates inside Auth0 and start using an external e-mail service. We already are using Mandrill in the company. In fact, Auth0 is now connecting to that to use it as an SMTP service.

One question that was asked was if it would be possible to make localized e-mail templates. Since all variations of the template are in one big HTML currently, I’m not all too happy going down that rabbit hole.

I would reckon that it would incorporate using Actions or Rules calling into - in our case - the Mandrill API?

Thanks for your help!

This doc covers the things you described.

https://auth0.com/docs/customize/email/manage-email-flow

Thanks again @dan.woda

One last thing I need to ask. The e-mail provider settings allow you to specify just one single From e-mail address.

When sending different e-mails based on a single template (like we are using the Change Password template), some customization is possible in there in the From field.

Currently we’re using this construct to change the sender of the e-mail.

{% if application.clientID == 'xyz' %} Application one {% else %} Fallback application {% endif %} <our@emailaddress.com>

In the past, it was not possible to make the actual e-mail address dynamic.
The following construct was not working (not tested if it’s still not working)
{% if application.clientID == 'xyz' %} Application one <app1@email.com> {% else %} Fallback application <fallback@email.com> {% endif %}.

Is there perhaps another way to work around this?

Kind regards

Emiel

I just tested it, and this seems to be working fine for me. To confirm, you are trying to add this conditional statement in the From field of the template, correct?

Hi @dan.woda, yes! That’s correct!

Let me try it out again. So, to be clear, in the E-mail Provider section you defined email1@blah.com (in our case it would be the Mandrill Settings)

image

and in the template you can use {% if application.clientID == 'xyz' %} Application one <email1@blah.com> {% else %} Fallback application <totally.different@email.com> {% endif %} ?

I’m guessing Mandrill needs to be somehow configured to accept messages being relayed from this other domain as well?

I’m using Mailgun, and it worked without having to register anything. The Customize Email Templates doc mention you may have to set up a Sender Policy Framework - Wikipedia, but I’m not sure.

I would just test it and see the result. Let me know! :smiley:

1 Like