Send email using AWS SES¶
Airflow can be configured to send e-mail using AWS SES as the
email_backend, so that task callback emails (success, failure, retry) go out through SES instead
of SMTP. See Email Configuration for the general Airflow email configuration this
page builds on.
Note
If you instead want to send an email as a Dag task, use the SesEmailOperator documented in Amazon Simple Email Service (SES).
Follow the steps below to enable it:
Install the
amazonprovider as part of your Airflow installation:pip install 'apache-airflow[amazon]'
Update the
[email]section inairflow.cfg:[email] email_backend = airflow.providers.amazon.aws.utils.emailer.send_email email_conn_id = aws_default from_email = From email <email@example.com>
Equivalent environment variables look like:
AIRFLOW__EMAIL__EMAIL_BACKEND=airflow.providers.amazon.aws.utils.emailer.send_email AIRFLOW__EMAIL__EMAIL_CONN_ID=aws_default AIRFLOW__EMAIL__FROM_EMAIL=email@example.com
from_emailis required and must be a sender address verified with SES.Create a connection called
aws_default, or choose a custom connection name and set it inemail_conn_id, of typeAmazon Web Services. See Managing Connections for how to create a connection.