Custom HTML template is not working on Airflow

Issue

This Content is from Stack Overflow. Question asked by Manigandan

Am trying to use a custom body template for the alert emails on airflow. Have created a file with the below message for testing purpose and mapped the file path to the variable html_content_template in the airflow.cfg file

Try {{try_number}} out of {{max_tries + 1}}<br>
Exception:<br>{{exception_html}}<br>
Log: <a href="{{ti.log_url}}">Link</a><br>
Host: ***.***.***.***<br> Use this ip address as hostname instead of localhost to check 
for logs and change status.
Mark success: <a href="{{ti.mark_success_url}}">Link</a><br>

Another issue, from_email config is also not working when have given a custom email address to send.

Airflow Version: 2.2.5
Ubuntu: 20.x
email_backend = airflow.utils.email.send_email_smtp



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?