Skip to content

[v3-4-test] Deprecate airflow.utils.email in favor of the SMTP provider (#75414) - #75709

Merged
vatsrahul1001 merged 2 commits into
v3-4-testfrom
backport-ad6ec79-v3-4-test
Oct 27, 2026
Merged

vatsrahul1001 merged 2 commits into
v3-4-testfrom
backport-ad6ec79-v3-4-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor
  • Deprecate airflow.utils.email in favor of the SMTP provider

The email utilities now live in airflow.providers.smtp.utils.emailer.
airflow.utils.email keeps its public names as deprecated aliases of the
provider functions, so existing imports and email_backend settings keep
working with a DeprecatedImportWarning.

The default [email] email_backend value is unchanged. The Task SDK treats it
as "no custom backend" and sends alerts with SmtpNotifier, as before.

A regression test covers email sent from a server process, such as a
listener in the API server, with the SMTP login stored only in the metadata
database.

airflow-core now requires apache-airflow-providers-smtp>=3.2.0, the first
release that contains the emailer module.

  • Keep star imports of airflow.utils.email working and document the move

"from airflow.utils.email import *" imported the email functions before
they moved to the SMTP provider. Listing them in all keeps that import
working, with the same deprecation warning as named imports.

The email configuration guide now says where the functions live, that the
default email_backend value is unchanged, and that the moved functions do
not see settings changed at runtime with airflow.configuration.conf.set().

The coverage script entry for airflow/utils/email.py is left unchanged, so
this change stays within airflow-core.

  • Shorten the core email page and point to the SMTP provider docs

The SMTP server and connection setup is documented by the SMTP provider, so the core page now only explains email_backend and the [email] options shared by all backends, and links to the provider docs.

  • Explain what changes for callers of the deprecated email functions

Add a significant newsfragment, keep email_backend at its default in the docs note, and name the Connection lookup and configuration source in the deprecation warning.

  • Test that a plain script does not see a database-only SMTP Connection

Outside task and server processes the Connection lookup only searches environment variables and secrets backends, so the email is sent without a login. The newsfragment describes this; the test now covers it.
(cherry picked from commit ad6ec79)

Co-authored-by: Shivam Rastogi 6463385+shivaam@users.noreply.github.com

@vatsrahul1001
vatsrahul1001 marked this pull request as ready for review October 27, 2026 04:40
@vatsrahul1001
vatsrahul1001 enabled auto-merge (squash) October 27, 2026 04:40
…er (#75414)

* Deprecate airflow.utils.email in favor of the SMTP provider

The email utilities now live in airflow.providers.smtp.utils.emailer.
airflow.utils.email keeps its public names as deprecated aliases of the
provider functions, so existing imports and email_backend settings keep
working with a DeprecatedImportWarning.

The default [email] email_backend value is unchanged. The Task SDK treats it
as "no custom backend" and sends alerts with SmtpNotifier, as before.

A regression test covers email sent from a server process, such as a
listener in the API server, with the SMTP login stored only in the metadata
database.

airflow-core now requires apache-airflow-providers-smtp>=3.2.0, the first
release that contains the emailer module.

* Keep star imports of airflow.utils.email working and document the move

"from airflow.utils.email import *" imported the email functions before
they moved to the SMTP provider. Listing them in __all__ keeps that import
working, with the same deprecation warning as named imports.

The email configuration guide now says where the functions live, that the
default email_backend value is unchanged, and that the moved functions do
not see settings changed at runtime with airflow.configuration.conf.set().

The coverage script entry for airflow/utils/email.py is left unchanged, so
this change stays within airflow-core.

* Shorten the core email page and point to the SMTP provider docs

The SMTP server and connection setup is documented by the SMTP provider, so the core page now only explains email_backend and the [email] options shared by all backends, and links to the provider docs.

* Explain what changes for callers of the deprecated email functions

Add a significant newsfragment, keep email_backend at its default in the docs note, and name the Connection lookup and configuration source in the deprecation warning.

* Test that a plain script does not see a database-only SMTP Connection

Outside task and server processes the Connection lookup only searches environment variables and secrets backends, so the email is sent without a login. The newsfragment describes this; the test now covers it.
(cherry picked from commit ad6ec79)

Co-authored-by: Shivam Rastogi <6463385+shivaam@users.noreply.github.com>
@vatsrahul1001
vatsrahul1001 force-pushed the backport-ad6ec79-v3-4-test branch from a1d25ad to 9bfcd24 Compare October 27, 2026 05:41
@Lee-W Lee-W added this to the Airflow 3.4.0 milestone Oct 27, 2026
airflow-core now requires providers-smtp>=3.2.0 (email deprecation, #75414/#75709). The emailer source landed via #75704 but the in-repo provider version was still 3.1.1, so the CI image build failed resolving the floor. Mirrors the smtp slice of the 3.2.0 provider release (#75209): version + provider.yaml + changelog + doc refs.
@vatsrahul1001
vatsrahul1001 merged commit 3920978 into v3-4-test Oct 27, 2026
128 checks passed
@vatsrahul1001
vatsrahul1001 deleted the backport-ad6ec79-v3-4-test branch October 27, 2026 07:14
vatsrahul1001 pushed a commit that referenced this pull request Oct 27, 2026
The backport of #75414 (#75709) raised the SMTP provider version in its
pyproject.toml without refreshing uv.lock. The constraints jobs run
`uv sync`, which then tries to rewrite the lock file. The lock is
bind-mounted as a single file in the container, so the rename fails with
"Device or resource busy" and every "Generate constraints" job on
v3-4-test fails.
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.

3 participants