How to support sending Verification/Forgot Password Email's in Multiple langugagues

I have a SPA Universal Login which is localized that I use for and English and Spanish websites and I’m trying to configure how I can send Verification/Forgot Password Emails in both English and Spanish depending on the site the user is coming from. I’ve setup my custom email provider but the Auth0 docs tell me I can use only one template each for Verification/Forgot Password Emails. What is the recommended approach to support multiple languages for these email template types?

One thought I had is using some type of approach of if-else statement in the email templates where I have an English text version defined and a Spanish text version defined then use some type of condition to output the language I want to use? Maybe I can use the redirect_uri as my condition?

Here’s a potential solution I came up with:

For verification emails, you could create a Post User Registraton hook that identifies the user’s location and generates an email verification ticket using the Management API. Then in that same hook you can send an email using whatever email provider you have that is in the correct language and has the ticket/link.

For forgot password emails, you could have your site detect the user’s locale (here’s a post on how to do that in JavaScript) and send that to your backend, where it will get the user’s ID based on their email, generate an password reset ticket using the Management API and then send an email in the correct language that includes the ticket/link.

Hope this helps!

1 Like

Thanks for sharing it with the rest of community!