Skip to content

[v3-3-test] Restore pluggable email backend for task failure and retry alerts (#69877)#70129

Merged
potiuk merged 1 commit into
v3-3-testfrom
backport-f7dec02-v3-3-test
Jul 21, 2026
Merged

[v3-3-test] Restore pluggable email backend for task failure and retry alerts (#69877)#70129
potiuk merged 1 commit into
v3-3-testfrom
backport-f7dec02-v3-3-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Since #57354, task email_on_failure / email_on_retry alerts were routed
unconditionally through SmtpNotifier, silently ignoring the
[email] email_backend configuration. Custom backends (SES, SendGrid,
org-internal) stopped delivering failure/retry emails even though the
deprecated email_on_* parameters still worked.

This restores the old behaviour using the existing [email] email_backend
option -- no new configuration is introduced:

  • A non-default [email] email_backend is transparently wrapped in a new
    LegacyEmailBackendNotifier, so existing SES / SendGrid / custom backends
    keep delivering alerts unchanged. The backend is resolved from config at
    notify time, so the Task SDK keeps no static dependency on
    airflow.utils.email.
  • Otherwise the default SmtpNotifier is used, exactly as before.

The notifier lives in the Task SDK (airflow.sdk.execution_time.email_backend)
next to its only caller, so no extra provider needs to be installed for a
custom email backend to keep working.

Both failure-email entry points (the worker task-runner path and the
DAG-processor callback path) funnel through the same function, so the
selected backend is used consistently regardless of how the task failed.

The deprecated email_on_* parameters are not un-deprecated; this only keeps
their existing behaviour pluggable until removal in Airflow 4.
(cherry picked from commit f7dec02)

Co-authored-by: Jarek Potiuk jarek@potiuk.com

…y alerts (#69877)

Since #57354, task email_on_failure / email_on_retry alerts were routed
unconditionally through SmtpNotifier, silently ignoring the
[email] email_backend configuration. Custom backends (SES, SendGrid,
org-internal) stopped delivering failure/retry emails even though the
deprecated email_on_* parameters still worked.

This restores the old behaviour using the existing [email] email_backend
option -- no new configuration is introduced:

- A non-default [email] email_backend is transparently wrapped in a new
  LegacyEmailBackendNotifier, so existing SES / SendGrid / custom backends
  keep delivering alerts unchanged. The backend is resolved from config at
  notify time, so the Task SDK keeps no static dependency on
  airflow.utils.email.
- Otherwise the default SmtpNotifier is used, exactly as before.

The notifier lives in the Task SDK (airflow.sdk.execution_time.email_backend)
next to its only caller, so no extra provider needs to be installed for a
custom email backend to keep working.

Both failure-email entry points (the worker task-runner path and the
DAG-processor callback path) funnel through the same function, so the
selected backend is used consistently regardless of how the task failed.

The deprecated email_on_* parameters are not un-deprecated; this only keeps
their existing behaviour pluggable until removal in Airflow 4.
(cherry picked from commit f7dec02)

Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
@potiuk
potiuk marked this pull request as ready for review July 20, 2026 15:39
@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.3.1 milestone Jul 21, 2026
@potiuk
potiuk merged commit 1ebf5c9 into v3-3-test Jul 21, 2026
117 of 126 checks passed
@potiuk
potiuk deleted the backport-f7dec02-v3-3-test branch July 21, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants