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

Fixing SES backend - source (mail_from) must be string. #16166

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion airflow/providers/amazon/aws/utils/emailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from typing import List, Optional, Union

from airflow.configuration import conf
from airflow.providers.amazon.aws.hooks.ses import SESHook


Expand All @@ -36,8 +37,10 @@ def send_email(
) -> None:
"""Email backend for SES."""
hook = SESHook(aws_conn_id=conn_id)

mail_from = conf.get('smtp', 'SMTP_MAIL_FROM')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please guide if this is right approach or should we update the EmailOperator to have input for "from".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. Can you add tests to avoid regression?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @mik-laj, I will update the Pr with tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@satishmittal111 Are you able to update this PR with tests?

hook.send_email(
mail_from=None,
mail_from=mail_from,
to=to,
subject=subject,
html_content=html_content,
Expand Down