cropland-bv opened a new issue, #34554: URL: https://github.com/apache/airflow/issues/34554
### Apache Airflow version 2.7.1 ### What happened When defining an SMTP connection only the user and password are taken from the connection. The host, port, starttls, start_ssl, from_email, timeout and retry are all taken from the configuration and not from the connection. Although the smtp provider (https://airflow.apache.org/docs/apache-airflow-providers-smtp/1.0.0/index.html) provides all these fields. ### What you think should happen instead The following lines should be included in `airflow/utils/email.py` around line 246: if conn_id is not None: try: from airflow.hooks.base import BaseHook airflow_conn = BaseHook.get_connection(conn_id) smtp_user = airflow_conn.login smtp_password = airflow_conn.password smtp_host = airflow_conn.host smtp_port = airflow_conn.port extra = json.loads(airflow_conn.extra) smtp_starttls = not extra["disable_tls"] smtp_timeout = int(extra["timeout"]) smtp_retry_limit = int(extra["retry_limit"]) smtp_ssl = not extra["disable_ssl"] The from_email should be retrieved from the connection earlier in the call stack. ### How to reproduce Install the SMTP provider: pip install apache-airflow-providers-smtp Create an SMTP connection in the UI Set the `AIRFLOW__EMAIL__EMAIL_CONN_ID` environment variable to the connection id of the SMTP connection Use the EmailOperator (`from airflow.operators.email import EmailOperator`) in a DAG. Check the values that are used in send_mime_email. ### Operating System Ubuntu ### Versions of Apache Airflow Providers apache-airflow-providers-smtp==1.3.2 ### Deployment Docker-Compose ### Deployment details _No response_ ### 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]
