Repository navigation
Add emailer utilities to the SMTP provider - #74623
Merged
hussein-awala merged 2 commits intoOct 20, 2026
Merged
Conversation
Contributor
Author
|
@eladkal — could you help to an initial review? WE will have to merge this into next provider release beforew we can move things in the core. |
eladkal
reviewed
Oct 13, 2026
shivaam
force-pushed
the
codex/email-smtp-provider-only
branch
from
October 17, 2026 20:48
5ff60a1 to
f0a2130
Compare
Copy airflow.utils.email into airflow.providers.smtp.utils.emailer so that core can later deprecate its email module and delegate to the provider, once a provider release containing it is available. The module is a copy of the core module. The only code changes are the imports, which go through common.compat, and the Connection lookup, which uses BaseHook.get_connection as other providers do instead of importing airflow.models. SMTP settings still come from the [smtp] configuration section and only the login and password from the Connection. Routing these calls through SmtpHook instead would change behavior for existing setups, because the hook reads all settings from the Connection and retries differently. Tests are copied from core, with additional edge cases. The module is registered as an email backend.
shivaam
force-pushed
the
codex/email-smtp-provider-only
branch
from
October 17, 2026 21:01
f0a2130 to
97dcbc7
Compare
shivaam
marked this pull request as ready for review
October 17, 2026 21:04
eladkal
reviewed
Oct 20, 2026
eladkal
approved these changes
Oct 20, 2026
The emailer documentation now explains what the module does and how it is configured, without mentioning where the code came from.
hussein-awala
approved these changes
Oct 20, 2026
1 task done
1 task done
28 of 93 tasks
1 task done
Contributor
Backport successfully created: v3-4-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
vatsrahul1001
pushed a commit
that referenced
this pull request
Oct 27, 2026
* Add core email utilities to the SMTP provider Copy airflow.utils.email into airflow.providers.smtp.utils.emailer so that core can later deprecate its email module and delegate to the provider, once a provider release containing it is available. The module is a copy of the core module. The only code changes are the imports, which go through common.compat, and the Connection lookup, which uses BaseHook.get_connection as other providers do instead of importing airflow.models. SMTP settings still come from the [smtp] configuration section and only the login and password from the Connection. Routing these calls through SmtpHook instead would change behavior for existing setups, because the hook reads all settings from the Connection and retries differently. Tests are copied from core, with additional edge cases. The module is registered as an email backend. * Describe the SMTP emailer without referring to core The emailer documentation now explains what the module does and how it is configured, without mentioning where the code came from. (cherry picked from commit 3199497) Co-authored-by: Shivam Rastogi <6463385+shivaam@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Copies
airflow/utils/email.pyinto the SMTP provider asairflow.providers.smtp.utils.emailer, and registers it as an email backend. This is the first step of moving email out of core (#30530). Core is not changed here.The code is the same as core's, except that imports go through
common.compatand the Connection is looked up withBaseHook.get_connection. Core's tests are copied too.SmtpHookis unchanged.Testing
Real email to a local SMTP server (Mailpit, login required), using the provider built from this branch:
email_backend. Checked on Airflow 2.11, 3.1, 3.3 and main.Next steps
airflow.utils.email(existing imports keep working, with a warning), points the defaultemail_backendat this module, and raises core's minimum SMTP provider version.SmtpHookreuse this module's MIME helpers instead of its own copy, tidy the module, and fixget_email_address_listdropping recipients when given a generator.related: #30530
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines