Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emailoperator with connection, missing config variable support (from_email), prefering airflow.cfg variable #31211

Open
1 of 2 tasks
ITJamie opened this issue May 11, 2023 · 4 comments
Assignees

Comments

@ITJamie
Copy link

ITJamie commented May 11, 2023

Apache Airflow version

2.6.0

What happened

the email operator when used with a connection is hard coded to use the smtp/smtp_mail_from and email/from_email variables from the airflow configuration. this should be adjusted to check if the connection has these vars set and prefer those instead.

there is a warning about configuration of email from airflow configuration being unsupported soon, so these config vars need to be supported in connections

What you think should happen instead

if smtp_mail_from and from_email are set in extra_vars on a connection it should prefer those

How to reproduce

setup airflow.cfg with incorrect smtp/smtp_mail_from and email/from_email variables.
attempt to override these with variables on an email connection
use the emailoperator with the new connection to send an email
see that the email was sent with the variables set in airflow.cfg

Operating System

Debian GNU/Linux 11 (bullseye)

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

bitnami containers on baremetal debian with docker-compose

Anything else

lines which need to be adjusted to support connection based vars:

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@ITJamie ITJamie added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels May 11, 2023
@ITJamie ITJamie changed the title emailoperator with connection, not pulling from_email/smtp_mail_from, prefering airflow.cfg variable emailoperator with connection, missing config variable support (from_email), prefering airflow.cfg variable May 11, 2023
@pierrejeambrun pierrejeambrun added kind:feature Feature Requests and removed kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels May 11, 2023
@arjunanan6
Copy link
Contributor

I would like to take this one, it seems do-able! :)

@potiuk
Copy link
Member

potiuk commented May 12, 2023

Assigned you, but there is another related in #31219 and likley also it needs to hold on a bit as @hussein-awala does refactoring of the email operator, so maybe it will end up with all of the people involved here reviewing and commenting single PR of @hussein-awala to see if we can improve some cases (cc: @eladkal as well).

@hussein-awala
Copy link
Member

Configuring the email operator and email util through Airflow configuration will soon be deprecated. It will be highly recommended to configure them via Airflow connections, as this approach will be fully supported.

There is already an open issue and linked PR for the Email operator #30530, and I'm trying to do the same thing for the send_email util. I am a bit late on this topic as I was very busy with other tasks during the past two weeks. However, I will make an effort to complete it before version 2.6.2.

@arjunanan6
Copy link
Contributor

@potiuk This should probably be assigned to @ITJamie as they're already working on it. I didn't realize there was a pull request already.

@pierrejeambrun pierrejeambrun assigned ITJamie and unassigned arjunanan6 May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants