A robust email address syntax and deliverability validation library. Current version is 2.3.0, released actively since mid-2021.
pip install email-validatorVerified import paths — ran on the pinned version, not inferred.
Quick example showing how to validate an email.
Use 'from email_validator import ...' instead of the old underscore version.
Use 'normalized' instead.
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.
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.
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`.
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)`.
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.
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.
No dependency data recorded yet.