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 2020/12/04 12:40:13 UTC

[GitHub] [airflow] siddartha-ravichandran commented on a change in pull request #12801: Introducing smtp timeout and retry limit for SMTP email backend.

siddartha-ravichandran commented on a change in pull request #12801:
URL: https://github.com/apache/airflow/pull/12801#discussion_r536071097



##########
File path: airflow/utils/email.py
##########
@@ -178,14 +180,23 @@ def send_mime_email(e_from: str, e_to: List[str], mime_msg: MIMEMultipart, dryru
         log.debug("No user/password found for SMTP, so logging in with no authentication.")
 
     if not dryrun:
-        conn = smtplib.SMTP_SSL(smtp_host, smtp_port) if smtp_ssl else smtplib.SMTP(smtp_host, smtp_port)
-        if smtp_starttls:
-            conn.starttls()
-        if smtp_user and smtp_password:
-            conn.login(smtp_user, smtp_password)
-        log.info("Sent an alert email to %s", e_to)
-        conn.sendmail(e_from, e_to, mime_msg.as_string())
-        conn.quit()
+        for attempt in range(smtp_retry_limit):

Review comment:
       Hi @mik-laj, did you mean `range(1, smtp_retry_limit+1)`? Because this will only iterate `smtp_retry_limit-1` times.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org