massamany opened a new issue #19805:
URL: https://github.com/apache/airflow/issues/19805
### Apache Airflow version
2.2.0
### Operating System
Ubuntu 18.04
### Versions of Apache Airflow Providers
Not relevant here
### Deployment
Other Docker-based deployment
### Deployment details
_No response_
### What happened
For my use cases, I need airflow to send emails, so I declared a Connection
of "Email" type.
As the SMTP server do not require authentication, I left the user / password
fields Empty in the Connection form. So that the user is an empty String in DB
and the password is null.
When using the `send_email` method in `email.py`, it appears that I get the
following deprecation warning in the logs : `Fetching SMTP credentials from
configuration variables will be deprecated in a future. release. Please set
credentials using a connection instead.`
In this case, this warning should not appear. In order to avoid it, I leave
the user empty but declare a 1-space password, so that the followin condition
in `email.py` is false and does not let the warning appear :
```
if smtp_user is None or smtp_password is None:
warnings.warn(
"Fetching SMTP credentials from configuration variables will be
deprecated in a future "
"release. Please set credentials using a connection instead.",
PendingDeprecationWarning,
stacklevel=2,
)
```
I think there are several solutions here, but I don't know which one will be
prefered. But the one I would choose would be to ignore authentication in
configuration as soon as there's a connection used or to warn as soon as the
configuration file is used for the SMTP parameters.
### What you expected to happen
No deprecation warning if a connection is used for STMP.
### How to reproduce
- declare a Email connexion without authentication
- use it to send a mail
- the undesired warning appears
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]