Skip to content

Callbacks

Airflow callback functions are often used to send emails, slack messages, or other notifications when a task fails, succeeds, or is retried. They can also run any general Python function.

orbiter.objects.callbacks.smtp.OrbiterSmtpNotifierCallback

An Airflow SMTP Callback

Note

Use smtp_conn_id and reference an SMTP Connection.

You can use the **conn_id("SMTP", conn_type="smtp") utility function to set both properties at once.

>>> [_import] = OrbiterSmtpNotifierCallback(to="foo@test.com").imports; _import
OrbiterRequirement(names=[send_smtp_notification], package=apache-airflow-providers-smtp, module=airflow.providers.smtp.notifications.smtp, sys_package=None)
>>> OrbiterSmtpNotifierCallback(to="foo@test.com", from_email="bar@test.com", subject="Hello", html_content="World")
send_smtp_notification(to='foo@test.com', from_email='bar@test.com', smtp_conn_id='SMTP', subject='Hello', html_content='World')
>>> OrbiterSmtpNotifierCallback(to=["foo@test.com", "baz@test.com"], from_email="bar@test.com", subject="Hello", html_content="World")
send_smtp_notification(to=['foo@test.com', 'baz@test.com'], from_email='bar@test.com', smtp_conn_id='SMTP', subject='Hello', html_content='World')

Parameters:

Name Type Description
to str | Sequence[str]

The email address to send to

from_email str, optional

The email address to send from

smtp_conn_id str, optional

The connection id to use (Note: use the **conn_id(...) utility function). Defaults to "SMTP"

subject str, optional

The subject of the email

html_content str, optional

The content of the email

cc str | Sequence[str], optional

The email address to cc

**OrbiterBase

OrbiterBase inherited properties