Email Validator
raw JSON → 2.3.0 verified Tue May 12 auth: no python install: verified quickstart: verified
A robust email address syntax and deliverability validation library. Current version is 2.3.0, released actively since mid-2021.
pip install email-validator Common errors
error ModuleNotFoundError: No module named 'email_validator' ↓
cause The `email-validator` package is installed via `pip install email-validator`, but is typically imported using `from email_validator import validate_email` or similar. This error occurs if the package is not installed or if there's a typo in the import statement.
fix
Ensure the package is installed correctly using
pip install email-validator. If already installed, verify the import statement is from email_validator import validate_email, EmailNotValidError. error email_validator.EmailNotValidError ↓
cause This is the base exception raised by the `validate_email` function when an email address does not pass validation checks, which could be due to syntax issues, a non-existent domain, or other validation rules.
fix
Wrap calls to
validate_email() in a try...except EmailNotValidError as e: block to gracefully handle invalid email addresses and access the human-readable error message str(e). error email_validator.EmailUndeliverableError: The domain name ____ does not exist. ↓
cause This specific `EmailNotValidError` subclass is raised when `validate_email` (with `check_deliverability=True`, which is the default) cannot find MX records for the domain, indicating the domain cannot receive email or does not exist.
fix
If deliverability checks are not required (e.g., for login forms or testing), call
validate_email(email, check_deliverability=False). Otherwise, the email address genuinely has an unresolvable domain. error RecursionError: maximum recursion depth exceeded ↓
cause This error typically occurs when a user defines a function named `validate_email` in their own code, which then inadvertently calls itself recursively instead of the imported `email_validator.validate_email` function.
fix
Rename your local validation function to something distinct (e.g.,
my_validate_email) to avoid shadowing the imported validate_email function from the email_validator library. Warnings
breaking Changed package import from 'email_validator' to 'email-validator'. ↓
fix Use 'from email_validator import ...' instead of the old underscore version.
deprecated Using 'email' field on ValidatedEmail is deprecated. ↓
fix Use 'normalized' instead.
breaking The library reports that the domain does not accept email. This indicates a change in how email_validator interprets domain records (e.g., MX records, DMARC/SPF policies, or explicit no-email configurations), leading to stricter validation. ↓
fix Verify the domain's MX records and DMARC/SPF policies. If the domain example.com is expected to accept email, this suggests a stricter validation policy has been introduced in a newer email_validator version. Adjust test data or consult the library's changelog for specific behavior changes related to domain validation.
gotcha Email validation fails with 'The domain name example.com does not accept email.', indicating a change in how domain email acceptance is determined (e.g., changes in MX record checking or DNS resolution behavior). ↓
fix Verify the domain's MX records and other DNS settings. If using `email_validator`, investigate if its internal DNS lookup mechanism or the default settings for verifying email acceptance have changed in the current version, or if external DNS resolvers are causing issues.
Install compatibility verified last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.29s 21.3M
3.10 slim (glibc) - - 0.20s 22M
3.11 alpine (musl) - - 0.95s 23.6M
3.11 slim (glibc) - - 0.77s 24M
3.12 alpine (musl) - - 0.57s 15.4M
3.12 slim (glibc) - - 0.66s 16M
3.13 alpine (musl) - - 0.54s 15.1M
3.13 slim (glibc) - - 0.61s 16M
3.9 alpine (musl) - - 0.26s 20.5M
3.9 slim (glibc) - - 0.21s 21M
Imports
- validate_email
from email_validator import validate_email
Quickstart verified last tested: 2026-04-23
from email_validator import validate_email, EmailNotValidError
try:
validate_email('test@example.com') # Validate.
except EmailNotValidError as e:
print(str(e)) # Handle the error.