You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "BalaMuralibi (via GitHub)" <gi...@apache.org> on 2024/12/20 13:32:57 UTC

[I] Providing SMTP user and password from airflow.cfg or environment variables [airflow]

BalaMuralibi opened a new issue, #45114:
URL: https://github.com/apache/airflow/issues/45114

   ### Apache Airflow version
   
   2.10.4
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Currently airflow smtp email.py utils is not taking  ```user, password``` values from airflow.cfg/env variables, rather it gets ```user, password``` values from smtp connection https://github.com/apache/airflow/blob/main/airflow/utils/email.py#L245-L246
   
   ```
   AIRFLOW__EMAIL__EMAIL_BACKEND: airflow.utils.email.send_email_smtp
   AIRFLOW__SMTP__SMTP_HOST: host
   AIRFLOW__SMTP__SMTP_STARTTLS: true
   AIRFLOW__SMTP__SMTP_SSL: False
   AIRFLOW__SMTP__SMTP_USER: "user@domain"
   AIRFLOW__SMTP__SMTP_PASSWORD: 'pwd'
   AIRFLOW__SMTP__SMTP_PORT: 25
   AIRFLOW__SMTP__SMTP_MAIL_FROM: from@email.com 
   ```
   
   ### What you think should happen instead?
   
   In production its not realistic to manually supply smtp user password in connection, thus it would be ideal to consider to get ```user and password ``` from airflow.cfg in case they are supplied ``AIRFLOW__SMTP__SMTP_USER: "user@domain"  AIRFLOW__SMTP__SMTP_PASSWORD: 'pwd' ```.
   
   
   ### How to reproduce
   
   na
   
   ### Operating System
   
   na
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] 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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Providing SMTP user and password from airflow.cfg or environment variables [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #45114:
URL: https://github.com/apache/airflow/issues/45114#issuecomment-2563495320

   I have no idea if it's a good format or not or whether there are some typos or lack of variables. But you should  make sure to create your env variable using the tool we provided (just scroll down). URLs need a number of escaping - especially if your password contains special characters (this is how URL works) and the tooling we create. In the document I linked above there are both - tools that allow you to generate proper URL as well as an explanation how you can use JSON stored in an env variable to avoid escaping. I recommend you to read and follow those.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Providing SMTP user and password from airflow.cfg or environment variables [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #45114: Providing SMTP user and password from airflow.cfg or environment variables
URL: https://github.com/apache/airflow/issues/45114


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Providing SMTP user and password from airflow.cfg or environment variables [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #45114:
URL: https://github.com/apache/airflow/issues/45114#issuecomment-2557027610

   Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Providing SMTP user and password from airflow.cfg or environment variables [airflow]

Posted by "BalaMuralibi (via GitHub)" <gi...@apache.org>.
BalaMuralibi commented on issue #45114:
URL: https://github.com/apache/airflow/issues/45114#issuecomment-2563464764

   Thanks for your reply. I had tried with connection variable  ```AIRFLOW_CONN_SMTP_DEFAULT: smtp://$(smtpuser):$(smtppwd)@host25?disable_ssl=true ``` prior posting here. It didn't help.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Providing SMTP user and password from airflow.cfg or environment variables [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #45114:
URL: https://github.com/apache/airflow/issues/45114#issuecomment-2557671530

   For the future - please use discussions if you have a question or doubt of that sort. Issues are for reporting problems that are airflow problems and when you want to do something and do not know how, open discussion.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Providing SMTP user and password from airflow.cfg or environment variables [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on issue #45114:
URL: https://github.com/apache/airflow/issues/45114#issuecomment-2557670351

   You can provide them as connection variables: https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#storing-connections-in-environment-variables


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org