You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/06 09:12:21 UTC

[GitHub] [airflow] ignaski commented on a change in pull request #18042: Fixing ses email backend

ignaski commented on a change in pull request #18042:
URL: https://github.com/apache/airflow/pull/18042#discussion_r702739485



##########
File path: airflow/utils/email.py
##########
@@ -85,7 +85,18 @@ def send_email_smtp(
 
     >>> send_email('test@example.com', 'foo', '<b>Foo</b> bar', ['/dev/null'], dryrun=True)
     """
-    smtp_mail_from = conf.get('smtp', 'SMTP_MAIL_FROM')
+    from_email = kwargs.get('from_email') or os.environ.get('SMTP_MAIL_FROM')
+    if not from_email and conf.has_option('smtp', 'smtp_mail_from'):
+        from_email = conf.get('smtp', 'smtp_mail_from')
+
+    from_name = kwargs.get('from_name') or os.environ.get('SMTP_MAIL_SENDER')
+    if not from_name and conf.has_option('smtp', 'smtp_mail_sender'):
+        from_name = conf.get('smtp', 'smtp_mail_sender')
+
+    if from_email:
+        smtp_mail_from = formataddr((from_name, from_email))
+    else:
+        smtp_mail_from = None

Review comment:
       Are you referring to `from_email` and `smtp_mail_from`? If `None` is passed to `formataddr` as email then the error message is very unclear 




-- 
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