bnspopi opened a new pull request, #74605:
URL: https://github.com/apache/airflow/pull/74605

   `email_on_failure` and `email_on_retry` build an `SmtpNotifier` with 
`from_email` already resolved from `[email] from_email` (or the hardcoded 
`airflow@airflow`). Because that value is never `None`, the notifier's own 
branch that reads the `from_email` extra of the SMTP connection never runs, so 
a connection configured with a sender is ignored for these emails. That is 
#69262.
   
   This moves the decision into `SmtpNotifier`, with the more specific setting 
winning:
   
   1. an explicitly passed `from_email`
   2. the SMTP connection's `from_email` extra
   3. the `[email] from_email` config
   
   The task runner now passes `from_email=None` so the notifier can see the 
connection. It still resolves the config itself for a custom `[email] 
email_backend`, since that signature takes the address.
   
   One behaviour change worth calling out: when neither the connection extra 
nor `[email] from_email` is set, the notifier raises as it already did for 
direct users, instead of sending from `airflow@airflow`. For task emails that 
error is caught and logged by the handler that already wraps this call, so the 
task is unaffected. Happy to keep the old `airflow@airflow` last resort instead 
if you would rather not change that.
   
   Tests: `test_notifier_from_email_precedence` covers connection-only, 
config-only and connection-over-config; 
`test_notifier_without_any_from_email_raises` pins the nothing-configured case. 
The three task-runner assertions for the SMTP path now expect `None`, and the 
custom-backend one still expects the resolved config value.
   
   I could not run the provider test suite on this machine, so the first full 
run will be CI here; happy to follow up on anything it flags.
   
   closes: #69262
   related: #69271
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (Claude Code)
   
   Generated-by: Claude Code following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


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