Chris Riccomini created AIRFLOW-734:
---------------------------------------

             Summary: Sending email with no AUTH fails
                 Key: AIRFLOW-734
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-734
             Project: Apache Airflow
          Issue Type: Bug
          Components: utils
    Affects Versions: Airflow 1.8
            Reporter: Chris Riccomini


While running 1.8.0a2, we noticed that emails no longer worked for us. We have 
these settings:

{noformat}
[smtp]
smtp_host = our.relay.com
smtp_starttls = False
smtp_ssl = False
smtp_port = 2525
smtp_mail_from = [email protected]
{noformat}

We are seeing:

{noformat}
[2017-01-05 15:10:13,666] {models.py:1378} ERROR - SMTP AUTH extension not 
supported by server.
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/airflow/models.py", line 1374, in 
handle_failure
    self.email_alert(error, is_retry=False)
  File "/usr/lib/python2.7/site-packages/airflow/models.py", line 1521, in 
email_alert
    send_email(task.email, title, body)
  File "/usr/lib/python2.7/site-packages/airflow/utils/email.py", line 43, in 
send_email
    return backend(to, subject, html_content, files=files, dryrun=dryrun, 
cc=cc, bcc=bcc, mime_subtype=mime_subtype)
  File "/usr/lib/python2.7/site-packages/airflow/utils/email.py", line 84, in 
send_email_smtp
    send_MIME_email(SMTP_MAIL_FROM, recipients, msg, dryrun)
  File "/usr/lib/python2.7/site-packages/airflow/utils/email.py", line 100, in 
send_MIME_email
    s.login(SMTP_USER, SMTP_PASSWORD)
  File "/usr/lib64/python2.7/smtplib.py", line 584, in login
    raise SMTPException("SMTP AUTH extension not supported by server.")
SMTPException: SMTP AUTH extension not supported by server.
{noformat}

It appears that the SMTP lib is trying to run the login() command in this code:

{code:python}
    if not dryrun:
        s = smtplib.SMTP_SSL(SMTP_HOST, SMTP_PORT) if SMTP_SSL else 
smtplib.SMTP(SMTP_HOST, SMTP_PORT)
        if SMTP_STARTTLS:
            s.starttls()
        if SMTP_USER and SMTP_PASSWORD:
            s.login(SMTP_USER, SMTP_PASSWORD)
        logging.info("Sent an alert email to " + str(e_to))
        s.sendmail(e_from, e_to, mime_msg.as_string())
        s.quit()
{code}

Even though we have no user/pass set. This didn't happen in 1.7.1.2. I also 
tried setting:

{noformat}
smtp_user = False
smtp_password = False
{noformat}

But this didn't help. Finally, I commented these lines out of the email 
email.py file:

{noformat}
        #if SMTP_USER and SMTP_PASSWORD:
        #    s.login(SMTP_USER, SMTP_PASSWORD)
{noformat}

The commenting worked. This suggests that the SMTP_USER and SMTP_PASSWORD are 
defaulting to a non-False value, and trying to force them to be false isn't 
working.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to