Auth0 Home Blog Docs

Email template macros replaced with empty string

email-template

#1

I am editing the Blocked Account Email template and have found that the user.city, user.country, user.source_ip macros are being replaced with an empty string when used in the message. However, the user.email, application.name, and connection.name all work as expected.

Do you have any ideas as to what is going on?


#2

Just discovered the {% debug %} macro. user.country, user.city, user.source_ip though mentioned in the documentation are not listed in the debug output.


#3

I was not able to reproduce the issue when I tested it by triggering the anomaly detection for real (failing the login attempt more than ten times from within my client application). In this situation my template containing:

We detected suspicious activity from the ip: {{ user.source_ip }} from {{ user.city }}, {{ user.country }}.

was rendered as expected and the email I received contain the three pieces of information I would expect (my IP address and location).

However, if I used the TRY option available on the template then I did indeed received the email with empty strings although in this situation given I was not actually performing a failed authentication I was not really expecting to receive the location information. In addition, I also tried the {% debug %} option and even in the real scenario that did not include the location information in the debug output although it did replace the other placeholders correctly.

From your question it is not clear how are you performing the tests so if you can update the question with the exact steps you’re using to reproduce that would be great.


#4