Skip to content

Commit

Permalink
[AIRFLOW-XXXX] Move email configuration from the concept page (apache…
Browse files Browse the repository at this point in the history
…#7189)

* [AIRFLOW-XXXX] Move email configration from the concept page

* fixup! [AIRFLOW-XXXX] Move email configration from the concept page
  • Loading branch information
mik-laj authored and turbaszek committed Jan 16, 2020
1 parent a611777 commit 44769dc
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 29 deletions.
31 changes: 2 additions & 29 deletions docs/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -909,35 +909,8 @@ setting ``check_slas=False`` under ``[core]`` section in ``airflow.cfg`` file:
[core]
check_slas = False
Email Configuration
-------------------

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.

.. code::
[email]
email_backend = airflow.utils.email.send_email_smtp
subject_template = /path/to/my_subject_template_file
html_content_template = /path/to/my_html_content_template_file
To access the task's information you use `Jinja Templating <http://jinja.pocoo.org/docs/dev/>`_ in your template files.

For example a ``html_content_template`` file could look like this:

.. code::
Try {{try_number}} out of {{max_tries + 1}}<br>
Exception:<br>{{exception_html}}<br>
Log: <a href="{{ti.log_url}}">Link</a><br>
Host: {{ti.hostname}}<br>
Log file: {{ti.log_filepath}}<br>
Mark success: <a href="{{ti.mark_success_url}}">Link</a><br>
.. note::
For information on the email configuration, see :doc:`howto/email-config`

.. _concepts/trigger_rule:

Expand Down
48 changes: 48 additions & 0 deletions docs/howto/email-config.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
.. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
.. http://www.apache.org/licenses/LICENSE-2.0
.. Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Email Configuration
-------------------

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.

.. code::
[email]
email_backend = airflow.utils.email.send_email_smtp
subject_template = /path/to/my_subject_template_file
html_content_template = /path/to/my_html_content_template_file
To access the task's information you use `Jinja Templating <http://jinja.pocoo.org/docs/dev/>`_ in your template files.

For example a ``html_content_template`` file could look like this:

.. code::
Try {{try_number}} out of {{max_tries + 1}}<br>
Exception:<br>{{exception_html}}<br>
Log: <a href="{{ti.log_url}}">Link</a><br>
Host: {{ti.hostname}}<br>
Log file: {{ti.log_filepath}}<br>
Mark success: <a href="{{ti.mark_success_url}}">Link</a><br>
.. note::
For more information on setting the configuration, see :doc:`set-config`
1 change: 1 addition & 0 deletions docs/howto/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ configuring an Airflow environment.
check-health
define_extra_link
tracking-user-activity
email-config

0 comments on commit 44769dc

Please sign in to comment.