{"id":394,"library":"email-validator","title":"Email Validator","description":"A robust email address syntax and deliverability validation library. Current version is 2.3.0, released actively since mid-2021.","status":"active","version":"2.3.0","language":"python","source_language":"en","source_url":"https://github.com/JoshData/python-email-validator","tags":["email","validation","syntax","deliverability"],"install":[{"cmd":"pip install email-validator","lang":"bash","label":"Install Email Validator"}],"dependencies":[],"imports":[{"note":"Ensure to import from the correct package name with a dash.","symbol":"validate_email","correct":"from email_validator import validate_email"}],"quickstart":{"code":"from email_validator import validate_email, EmailNotValidError\n\ntry:\n    validate_email('test@example.com')  # Validate.\nexcept EmailNotValidError as e:\n    print(str(e))  # Handle the error.\n","lang":"python","description":"Quick example showing how to validate an email."},"warnings":[{"fix":"Use 'from email_validator import ...' instead of the old underscore version.","message":"Changed package import from 'email_validator' to 'email-validator'.","severity":"breaking","affected_versions":"2.3.0"},{"fix":"Use 'normalized' instead.","message":"Using 'email' field on ValidatedEmail is deprecated.","severity":"deprecated","affected_versions":">=2.1.0"},{"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.","message":"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.","severity":"breaking","affected_versions":">=2.2.0"},{"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.","message":"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).","severity":"gotcha","affected_versions":"latest"}],"env_vars":null,"search_vec":"'-2021':20 '2.3.0':15 'activ':17 'address':6 'current':12 'deliver':9,24 'email':1,5,21 'librari':11 'mid':19 'releas':16 'robust':4 'sinc':18 'syntax':7,23 'valid':2,10,22 'version':13","created_at":"2026-03-28T11:14:44.591135+00:00","updated_at":"2026-04-16T14:48:23.100207+00:00","problems":[{"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`.","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.","error":"ModuleNotFoundError: No module named 'email_validator'"},{"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)`.","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.","error":"email_validator.EmailNotValidError"},{"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.","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.","error":"email_validator.EmailUndeliverableError: The domain name ____ does not exist."},{"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.","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.","error":"RecursionError: maximum recursion depth exceeded"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":80,"quickstart_tag":"verified","pypi_latest":"2.3.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/JoshData/python-email-validator","docs":null,"changelog":null,"pypi":"https://pypi.org/project/email-validator/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["auth-security","communication","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":"verified"}}