Jimmyman1465 opened a new pull request, #77857:
URL: https://github.com/apache/airflow/pull/77857
Fixes #77783
### Summary
Following PR #75414, Airflow keeps `[email] email_backend` defaulted to
`airflow.utils.email.send_email_smtp` (as documented in
`airflow-core/docs/howto/email-config.rst`), while `airflow.utils.email` emits
a `DeprecatedImportWarning` on attribute access.
Previously, `airflow.providers.smtp.utils.emailer.send_email()` always
resolved the backend via `conf.getimport("email", "EMAIL_BACKEND")`, which
imported `airflow.utils.email.send_email_smtp` and triggered the deprecation
warning even on an unmodified default configuration.
### Changes
- Check `conf.get("email", "EMAIL_BACKEND", fallback=None)` in
`airflow.providers.smtp.utils.emailer.send_email()` and dispatch directly to
`send_email_smtp` when the value equals
`"airflow.utils.email.send_email_smtp"`, falling back to
`conf.getimport("email", "EMAIL_BACKEND")` for custom backends.
- Add regression test `test_default_legacy_backend_avoids_deprecated_import`
in `providers/smtp/tests/unit/smtp/utils/test_emailer.py`.
### Verification
- Ran `TestEmailer` unit tests (`16 passed`, Windows-host skips on unrelated
`TestEmailerSmtp` POSIX `fcntl` / NTFS filename tests) and verified zero
`DeprecatedImportWarning` with default `[email] email_backend`.
- Ran `ruff check` and `ruff format --check` on the modified files.
--
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]