Registry /
workflow / apache-airflow-providers-smtp
Install & Compatibility
Where this runs
tested against v3.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 5.426s · 256.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 24.2s · import 5.036s · 255MB
256MB installed
● package 256MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SmtpHook
✓ from airflow.providers.smtp.hooks.smtp import SmtpHook
This hook provides the underlying SMTP client functionality.
EmailOperator
✓ from airflow.operators.email import EmailOperator
✗ from airflow.providers.smtp.operators.email import EmailOperator
The EmailOperator is part of Airflow core, not directly provided by this package, but relies on this provider for SMTP functionality.
This quickstart demonstrates a basic Airflow DAG that uses the `EmailOperator` to send an email. The `apache-airflow-providers-smtp` package must be installed, and an 'smtp_default' connection configured in Airflow for this to function correctly. This provider enables the underlying SMTP communication.
from airflow.operators.email import EmailOperator
from airflow.models.dag import DAG
from datetime import datetime
# NOTE: For this DAG to send emails, an 'smtp_default' connection
# must be configured in Airflow (Admin -> Connections) or via airflow.cfg.
# The apache-airflow-providers-smtp package provides the SmtpHook that EmailOperator uses.
with DAG(
dag_id='simple_email_notification',
start_date=datetime(2023, 1, 1),
schedule_interval=None,
catchup=False,
tags=['email_example'],
) as dag:
send_test_email = EmailOperator(
task_id='send_test_email',
to='your_recipient@example.com', # Replace with a valid email address
subject='Airflow Test Email from SMTP Provider',
html_content='<h3>Hello from Airflow!</h3><p>This email confirms your SMTP provider is working.</p>',
conn_id='smtp_default', # This connection ID should be configured
)
Debug
Known issues
gotchaThe `EmailOperator` (and other email features) critically depend on a properly configured `smtp_default` connection in Airflow. This connection must be set up in the Airflow UI (Admin -> Connections) or in `airflow.cfg` with the correct host, port, authentication, and TLS/SSL settings. Without it, email tasks will fail with connection errors.fixConfigure the 'smtp_default' connection in Airflow with valid SMTP server details. Ensure 'ssl_enable' or 'starttls_enable' are correctly set based on your SMTP server.
affects: All versions
gotchaThis provider package requires Python >= 3.10. Installing it in environments with older Python versions will lead to installation errors or runtime incompatibilities.fixEnsure your Airflow environment is running on Python 3.10 or newer. Upgrade Python if necessary, or use a virtual environment with the correct Python version.
affects: All versions >= 2.0.0
gotchaWhile the `EmailOperator` is part of Airflow core, its ability to send emails via SMTP relies entirely on the `apache-airflow-providers-smtp` package being installed. If the provider is missing, `EmailOperator` tasks will typically fail silently or with an error indicating a missing dependency or an inability to find a suitable hook.fixAlways ensure the `apache-airflow-providers-smtp` package is installed in your Airflow environment alongside Airflow core. Use `pip install apache-airflow-providers-smtp`.
affects: All versions
breakingThe `schedule_interval` argument for `DAG` instantiation has been removed in Airflow versions 2.4 and later. Using it will result in a `TypeError`. You must use the `schedule` argument instead.fixUpdate your DAG definitions to use `schedule=...` instead of `schedule_interval=...`. For example, `schedule=None`, `schedule='@daily'`, or `schedule=timedelta(days=1)`.
affects: Airflow versions >= 2.4.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'airflow.providers.smtp'
The 'apache-airflow-providers-smtp' package is not installed.
fixInstall the package using 'pip install apache-airflow-providers-smtp'.
ImportError: cannot import name 'SmtpHook' from 'airflow.providers.smtp.hooks.smtp'
The 'SmtpHook' class is not found in the specified module, possibly due to an incorrect import path or version mismatch.
fixEnsure you are importing 'SmtpHook' correctly: 'from airflow.providers.smtp.hooks.smtp import SmtpHook'.
AttributeError: module 'airflow.providers.smtp' has no attribute 'SmtpHook'
Attempting to import 'SmtpHook' directly from 'airflow.providers.smtp' instead of its submodule.
fixImport 'SmtpHook' from its correct submodule: 'from airflow.providers.smtp.hooks.smtp import SmtpHook'.
ImportError: cannot import name 'EmailOperator' from 'airflow.operators.email_operator'
The 'EmailOperator' has been moved to the 'apache-airflow-providers-smtp' package in newer versions of Airflow.
fixUpdate your import statement to: 'from airflow.providers.smtp.operators.smtp import EmailOperator'.
AirflowException: You should provide 'from_email' or define it in the connection.
The 'from_email' parameter is not provided, and it's also not defined in the SMTP connection settings.
fixProvide the 'from_email' parameter in your 'EmailOperator' or define it in your SMTP connection settings.
Upgrade
Version history
3.0.3latest on PyPI · released Aug 8, 2026
Audit
Dependencies
apache-airflowrequiredThis is an Airflow provider and requires a compatible version of Apache Airflow core.