amoghrajesh commented on PR #57354:
URL: https://github.com/apache/airflow/pull/57354#issuecomment-3456454692
@ashb @eladkal good call above thanks.
I tested with subject template as well as html body template and these are
the results:
Subject template:
```shell script
Custom Subject: {{ti.task_id}} failed in DAG {{ti.dag_id}}
```
Content template:
```shell script
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Custom Email Template</title>
</head>
<body>
<h2>Task Failure Notification</h2>
<p><strong>Task:</strong> {{ti.task_id}}</p>
<p><strong>DAG:</strong> {{ti.dag_id}}</p>
<p><strong>Run ID:</strong> {{ti.run_id}}</p>
<p><strong>Try Number:</strong> {{try_number}} of {{max_tries + 1}}</p>
<p><strong>Host:</strong> {{ti.hostname}}</p>
<h3>Exception Details:</h3>
<pre>{{exception_html}}</pre>
<p>
<a href="{{ti.log_url}}">View Logs</a> |
<a href="{{ti.mark_success_url}}">Mark Success</a>
</p>
</body>
</html>
```
Defined these env vars:
```shell script
export AIRFLOW__EMAIL__SUBJECT_TEMPLATE=/files/custom_email_subject.jinja2
export AIRFLOW__EMAIL__HTML_CONTENT_TEMPLATE=/files/custom_email_body.html
```
This is how it renders:
<img width="1724" height="883" alt="image"
src="https://github.com/user-attachments/assets/02c47123-975f-4fd2-a839-1bfe5b40d9c9"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]