How to Setup SMTP for Airflow
Author: Omid Vahdaty 26.4.2020
Step 1: Understand the basics of SMTP
SMTP to is a simple protocol to send emails – yes like GMAIL. For sending emails in smtp – you need client and server. You can use your own custom made SMTP server (python).
or use GMAIL as smtp server – e.g: user@myDomain.com ,
here is a link for basic GMAIL SMTP configuration:
Step 2: Configure SMTP client on your desktop
you can test the SMTP server , by installing email client on your desktop. It can be outlook (Paid) or thunderbird (Free):
The desired out put – read your own emails on a new client which IT / DEVOPS have not configured for your.
Step3: configure SMTP on Airflow configuration file
once you understand the concept of SMTP, you can configure SMTP on airflow.cfg
[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 = localhost smtp_starttls = True smtp_ssl = False # Example: smtp_user = airflow # smtp_user = # Example: smtp_password = airflow # smtp_password = smtp_port = 25 smtp_mail_from = email@example.com
STEP4: Use Airflow Email Operator in your DAG
I put a lot of thoughts into these blogs, so I could share the information in a clear and useful way. If you have any comments, thoughts, questions, or you need someone to consult with,
feel free to contact me via LinkedIn: