olayiwola-gbenga commented on PR #72745:
URL: https://github.com/apache/airflow/pull/72745#issuecomment-6056391547

   Thanks for the review @kaxil, and thanks @VladaZakharova for following up.
   
   On the business need: in Airflow 2 (`airflow.utils.email.send_email`), 
`from_email` defaulted to `None` when `[email] from_email` wasn't set in 
`airflow.cfg`. Many users migrating to Airflow 3 use a custom `[email] 
email_backend` (like SendGrid or Amazon SES, which now go through 
`_LegacyEmailBackendNotifier`) and leave `[email] from_email` unset so the 
backend can fall back to its own sender config (such as the 
`SENDGRID_MAIL_FROM` env var or connection extras).
   Because `_send_error_email_notification` currently passes 
`"airflow@airflow"` as the fallback, `_LegacyEmailBackendNotifier` passes 
`"airflow@airflow"` instead of `None` to the custom `send_email` function. That 
overrides the provider's own default sender and causes task failure/retry 
emails to be rejected due to an unverified sender address.
   
   @kaxil makes a good point about `SmtpNotifier`. When I started working on 
this, there was an open PR for #69262 that updated `SmtpNotifier` to fall back 
to `"airflow@airflow"` instead of raising a `ValueError` when 
`from_email=None`, while leaving `_LegacyEmailBackendNotifier` with the 
hardcoded `"airflow@airflow"`. Since that PR was closed without merging, 
passing `from_email=None` to `SmtpNotifier` currently raises a `ValueError` in 
a default setup when the SMTP connection doesn't have `from_email` set.
   
   Since the scope of our ticket is specifically to fix legacy/custom 
`email_backend` setups, I can update this PR so `fallback=None` is only used 
for `_LegacyEmailBackendNotifier` while keeping `fallback="airflow@airflow"` 
for `SmtpNotifier`, and update the tests accordingly.
   
   @kaxil could we reopen this PR so I can push that change?


-- 
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]

Reply via email to