我按照在线教程在airflow.cfg中设置了Email SMTP服务器,如下所示:
[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
Run Code Online (Sandbox Code Playgroud)
我的DAG如下:
from datetime import datetime
from airflow import DAG …Run Code Online (Sandbox Code Playgroud)