{"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,"last_verified":"2026-05-12T13:30:00.108Z","next_check":"2026-06-26T00:00:00.000Z","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,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.29,"mem_mb":1.1,"disk_size":"21.3M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.2,"mem_mb":1.4,"disk_size":"22M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.95,"mem_mb":1.5,"disk_size":"23.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.77,"mem_mb":1.5,"disk_size":"24M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.57,"mem_mb":1.2,"disk_size":"15.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.66,"mem_mb":1.2,"disk_size":"16M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.54,"mem_mb":1.4,"disk_size":"15.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.61,"mem_mb":1.1,"disk_size":"16M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.26,"mem_mb":1,"disk_size":"20.5M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.21,"mem_mb":1.3,"disk_size":"21M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}