Send email using SendGrid¶ Airflow can be configured to send e-mail using SendGrid. Follow the steps below to enable it: Include sendgrid subpackage as part of your Airflow installation, e.g., pip install 'apache-airflowsendgrid' Update emailbackend property in email section in airflow.cfg, i.e. Apache Airflow, Apache, Airflow, the Airflow logo, and the Apache feather logo are either registered trademarks or trademarks of The Apache Software Foundation.
You can configure the email that is being sent in your airflow.cfg
by setting a subject_template
and/or a html_content_template
in the [email]
section.
If you want to check which email backend is currently set, you can use airflowconfigget-valueemailemail_backend
command as inthe example below.
- To install the SendGrid NuGet package in your application, do the following: Click on New Project and select a Template. In Solution Explorer, right-click References, then click Manage NuGet Packages. Search for SendGrid and select the SendGrid item in the results list. Select the latest stable version of the Nuget package from the version dropdown to be able to work with the object model.
- This is a couple of months old now, but for what it is worth I did not have any issue with making an HTTPS call on Airflow 1.10.2. In my initial test I was making a request for templates from sendgrid, so the connection was set up like this.
To access the task's information you use Jinja Templating in your template files.
Airflow Sendgrid Email
For example a html_content_template
file could look like this:
Note
For more information on setting the configuration, see Setting Configuration Options
Send email using SendGrid¶
Airflow Sendgrid Operator
Airflow can be configured to send e-mail using SendGrid.
Follow the steps below to enable it:
Include
sendgrid
subpackage as part of your Airflow installation, e.g.,
Update
email_backend
property in[email]
section inairflow.cfg
, i.e.Configure SendGrid specific environment variables at all Airflow instances: