Skip to content

Emails notifications with AWS SES not working due to missing "from:" field #17930

Description

@ecerulm

Apache Airflow version

main (development)

Operating System

macOsS

Versions of Apache Airflow Providers

apache-airflow-providers-amazon (main)

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

What happened

mail_from=None,
to=to,

    hook.send_email(
        mail_from=None,
        to=to,
        subject=subject,
        html_content=html_content,
        files=files,
        cc=cc,
        bcc=bcc,
        mime_subtype=mime_subtype,
        mime_charset=mime_charset,
    )

the mail_from=None will trigger an error when sending the mail, when using AWS Simple Email Service you need to provide a from address and has to be already verified in AWS SES > "Verified identities"

What you expected to happen

I expected it to send a mail but it doesn't because

How to reproduce

No response

Anything else

This is easily solved by providing a from address like in:

    smtp_mail_from = conf.get('smtp', 'SMTP_MAIL_FROM')
    hook.send_email(
        mail_from=smtp_mail_from,

the problem is: Can we reuse the smtp.SMTP_MAIL_FROM or do we need to create a new configuration parameter like email.email_from_address ?

  • smtp uses its own config smtp.smtp_mail_from
  • sendgrid uses an environment variable SENDGRID_MAIL_FROM (undocumented by the way)

So, my personal proposal is to

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions