Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am sending mail using airflow emailOperator. Is there any way to send "reply-to" parameter also. i tried
default_param={'key':'value'}
but throwing exception as invalid parameter.
I read this
https://github.com/apache/airflow/blob/main/airflow/operators/email.py
https://github.com/apache/airflow/blob/main/tests/operators/test_email.py
But I don't know where i am doing mistake.
version : 2.0.2
email_op = EmailOperator(
task_id='send_email',
to=destination['emails'],
subject=destination['subject'],
html_content=destination['message'],
files=[file.name],
default_param={'Reply-To': 'reply_to@example.com'},
email_op.execute(context)
It would be passed via dictionary custom_headers
, as per the Official Source Code and Official Docs
I actually took the Reply-To
directly from the official Airflow unit test.
There was a bug patched in release 2.3.0 with the send_email function to correctly pass the custom_headers. This might be your root cause...
Here is the link to the issue
Here is the pull request to resolve it
For new comers here is how you would send the custom_headers when using 2.3.0 and above.
from airflow.operators.email_operator import EmailOperator
t1 = EmailOperator(
task_id='send_email',
to="email@example.com",
subject="Airflow Example",
html_content=""" <h3>Email Test</h3> """,
cc="email@example",
custom_headers = {
'Reply-To': 'reply_to@example.com'
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.