title: Email on failure using AWS SES in Apache Airflow DAG
body: <p>I am trying to have Airflow email me using AWS SES whenever a task in my DAG fails to run or retries to run. I am using my AWS SES credentials rather than my general AWS credentials too.</p>
  
  <p>My current <strong>airflow.cfg</strong></p>
  
  <pre><code>[email]
  email_backend = airflow.utils.email.send_email_smtp
  
  
  [smtp]
  # If you want airflow to send emails on retries, failure, and you want to use
  # the airflow.utils.email.send_email_smtp function, you have to configure an
  # smtp server here
  smtp_host = emailsmtpserver.region.amazonaws.com 
  smtp_starttls = True
  smtp_ssl = False
  # Uncomment and set the user/pass settings if you want to use SMTP AUTH
  smtp_user = REMOVEDAWSACCESSKEY
  smtp_password = REMOVEDAWSSECRETACCESSKEY
  smtp_port = 25
  smtp_mail_from = myemail@myjob.com
  </code></pre>
  
  <p>Current task in my DAG that is designed to intentionally fail and retry:</p>
  
  <pre><code>testfaildag_library_install_jar_jdbc = PythonOperator(
      task_id='library_install_jar',
      retries=3,
      retry_delay=timedelta(seconds=15),
      python_callable=add_library_to_cluster,
      params={'_task_id': 'cluster_create', '_cluster_name': CLUSTER_NAME, '_library_path':s3000://fakepath.jar},
      dag=dag,
      email_on_failure=True,
      email_on_retry=True,
      email=’myname@myjob.com’,
      provide_context=True
  )
  </code></pre>
  
  <p>Everything works as designed as the task retries the set number of times and ultimately fails, except no emails are being sent. I have checked the logs in the task mentioned above too, and smtp is never mentioned.</p>
  
  <p>I've looked at the similar question <a href="https://stackoverflow.com/questions/44573923/how-do-i-setup-airflows-email-configuration-to-send-an-email-on-errors">here</a>, but the only solution there did not work for me. Additionally, Airflow's documentation such as their example <a href="https://airflow.incubator.apache.org/tutorial.html?highlight=email" rel="nofollow noreferrer">here</a> does not seem to work for me either.</p>
  
  <p><strong>Does SES work with Airflow's email_on_failure and email_on_retry functions?</strong> </p>
  
  <p>What I am currently thinking of doing is using the <code>on_failure_callback</code> function to call a python script provided by AWS <a href="https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-using-sdk-python.html" rel="nofollow noreferrer">here</a> to send an email on failure, but that is not the preferable route at this point.</p>
  
  <p>Thank you, appreciate any help.</p>