Skip to content

Providing SMTP user and password from airflow.cfg or environment variables #45114

Description

@BalaMuralibi

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?

Please suggest if there is a work around to provide smtp password securely.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions