stark256-spec commented on issue #34554:
URL: https://github.com/apache/airflow/issues/34554#issuecomment-5261693207

   I'd like to take this one. Confirmed it still reproduces on current `main`.
   
   In `send_mime_email` (`airflow-core/src/airflow/utils/email.py`), the 
transport settings — `smtp_host`, `smtp_port`, `smtp_starttls`, `smtp_ssl`, 
`smtp_retry_limit`, `smtp_timeout` — are all read from `conf.get*("smtp", …)`. 
When a `conn_id` resolves a connection, only `login` and `password` are read 
from it; the connection's `host`, `port`, and `extra` are ignored. So 
configuring an SMTP *connection* still silently takes host/port/TLS from global 
config.
   
   Plan — make `send_mime_email` prefer the connection's values, each falling 
back to the existing config value when the connection doesn't provide it (so 
behavior is unchanged for anyone not populating these fields):
   - `host` ← `conn.host`, `port` ← `conn.port`
   - `smtp_starttls` ← `not extra["disable_tls"]`, `smtp_ssl` ← `not 
extra["disable_ssl"]`
   - `smtp_timeout` ← `extra["timeout"]`, `smtp_retry_limit` ← 
`extra["retry_limit"]`
   
   Key names and negation semantics are taken from `SmtpHook` 
(`providers/smtp/.../hooks/smtp.py`) so the two paths stay consistent. I'll 
scope `from_email` out of this change — in the current code it's resolved in 
`send_email_smtp`, not `send_mime_email`, so it belongs to a separate fix. Unit 
tests to be added in `airflow-core/tests/unit/utils/test_email.py` covering 
both connection-provided and config-fallback cases.
   
   Will open a PR shortly following the PR template.


-- 
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]

Reply via email to