How to set up Airflow Send Email? : <p>I followed online tutorial to set up Email SMTP server in airflow.cfg as below:</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 = smtp.gmail.com
smtp_starttls = True
smtp_ssl = False
# Uncomment and set the user/pass settings if you want to use SMTP AUTH 
# smtp_user =                       
# smtp_password =  
smtp_port = 587
smtp_mail_from = myemail@gmail.com
</code></pre>

<p>And my DAG is as below:</p>

<pre><code>from datetime import datetime
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.email_operator import EmailOperator

def print_hello():
    return 'Hello world!'

default_args = {
        'owner': 'peter',
        'start_date':datetime(2018,8,11),
}

dag = DAG('hello_world', description='Simple tutorial DAG',
          schedule_interval='* * * * *',
          default_args = default_args, catchup=False)

dummy_operator = DummyOperator(task_id='dummy_task', retries=3, dag=dag)

hello_operator = PythonOperator(task_id='hello_task', python_callable=print_hello, dag=dag)

email = EmailOperator(
        task_id='send_email',
        to='to@gmail.com',
        subject='Airflow Alert',
        html_content=""" &lt;h3&gt;Email Test&lt;/h3&gt; """,
        dag=dag
)

email &gt;&gt; dummy_operator &gt;&gt; hello_operator
</code></pre>

<p>I assumed the email operator will run after the other two operators and then send me an email.
But email was not sent to me.
I really appreciate your help. Thank you very much.</p>

<p>Best</p>
