email-validator

Robust email address syntax and deliverability validation for Python

Library
PyPI
v2.3.0
1,454 stars
Unlicense

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
65 /100 Good
Development Activity 60
Maintenance 36
Community 64
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
71 /100 Good
Architecture 74
Code Quality 76
Innovation 62
Learning Curve 70

email-validator is an opinionated Python library that checks whether a string is a well-formed, deliverable email address. It validates syntax against RFC rules, supports internationalized domain names and local parts, and optionally performs DNS-based deliverability checks (MX/A/AAAA records) so applications can reject unreachable domains before storing them.

Beyond a pass/fail check, it returns a normalized form of the address that should be stored and compared going forward, along with structured fields like the ASCII-ized form, display name, and parsed domain-literal IP addresses when applicable. It deliberately rejects obsolete or unsafe address forms (special-use domains, unsafe Unicode) that would otherwise cause grief in registration and login flows.

What You Get

  • validate_email() returning a normalized address plus ASCII-ized, display-name, and domain-literal fields
  • EmailSyntaxError and EmailUndeliverableError exception classes (both subclasses of EmailNotValidError/ValueError) with friendly, end-user-displayable messages
  • Optional DNS-based deliverability checks (MX record lookup with A/AAAA fallback) via a pluggable dns.resolver.Resolver
  • A caching_resolver() helper for reusing DNS lookups across many validations with a timeout and LRU cache
  • Support for internationalized domain names (IDNA 2008) and internationalized/quoted local parts
  • Configurable options for quoted-local-parts, domain literals, display names, empty local parts, and stricter RFC compliance

Common Use Cases

  • Validating email addresses on account registration forms before writing them to a database
  • Normalizing stored email addresses so duplicate-detection and login lookups are consistent
  • Skipping DNS checks on login forms (check_deliverability=False) while enforcing them at signup
  • Accepting internationalized email addresses (non-ASCII domains and local parts) correctly
  • Allowing test-only @test/@*.test domains in non-production environments via test_environment=True

Under The Hood

Architecture: The library is a small, focused pipeline: syntax.py implements RFC-5321/5322/6531-aware parsing of the local part and domain, rfc_constants.py centralizes the character-class and length constants those checks rely on, deliverability.py performs the optional DNS MX/A/AAAA lookups through a caller-supplied or default dns.resolver.Resolver, and validate_email.py in email_validator/ orchestrates the two stages and assembles the returned ValidatedEmail object defined in types.py. exceptions.py defines the EmailNotValidError hierarchy consumed by callers.

Tech Stack: Pure Python 3.10+ with dnspython and idna as the only meaningful runtime dependencies (for DNS resolution and IDNA 2008 domain encoding respectively). Packaged with setuptools/pyproject.toml, distributed as a universal wheel, and ships py.typed for full type-annotation support in consuming codebases.

Code Quality: tests/test_syntax.py, tests/test_deliverability.py, and tests/test_main.py cover syntax edge cases (IDN, quoted locals, domain literals), DNS-check behavior, and CLI usage; CI runs them via GitHub Actions (test_and_build.yaml) across supported Python versions. Error paths are modeled as typed exceptions with descriptive messages rather than generic ValueErrors, and the codebase is fully type-annotated.

API Design: The primary entry point is a single function, validate_email(email, **options), with all behavior controlled by well-documented keyword arguments and module-level defaults (e.g. email_validator.CHECK_DELIVERABILITY) that can be set once for an app. This keeps the common case (‘is this address valid, and what’s its normalized form’) to two or three lines, while advanced options (quoted locals, domain literals, custom resolvers) stay opt-in rather than cluttering the default call.

Used by 14 apps in this directory

Python
49%
Other

Arize Phoenix

Analytics · Devops · Monitoring

11,976

Open-source AI observability platform for tracing, evaluating, and debugging LLM applications with built-in intelligence and MCP support.

View details
92
Repo Health
88
Technical
67
Dependency
Built with
Python 49%
TypeScript 43%
Updated 5 days ago
Python
62%
Apache 2.0

Polar

Developer Tools · Ecommerce · Invoicing Finance

10,410

Open source payments infrastructure that turns software into a business — subscriptions, usage-based billing, digital products, and merchant-of-record compliance in one platform.

View details
90
Repo Health
82
Technical
66
Dependency
Built with
Python 62%
TypeScript 31%
Updated 6 days ago
Python
79%
AGPL 3.0

Skyvern

AI Agents · Automation

23,257

Skyvern (YC S2023) automates browser-based workflows by pairing LLMs with computer vision, letting agents click, fill, and extract data on sites they've never seen, without brittle XPath selectors that break on every layout change.

View details
89
Repo Health
82
Technical
70
Dependency
Built with
Python 79%
TypeScript 19%
Updated 5 days ago
Python
59%
AGPL 3.0

Speakr

AI Assistants

4,112

Self-hosted AI transcription with speaker diarization, smart tagging, and multi-user collaboration — your recordings stay on your infrastructure.

View details
84
Repo Health
79
Technical
70
Dependency
Built with
Python 59%
HTML 21%
JavaScript 17%
Updated 6 days ago
Python
68%
AGPL 3.0

Tracecat

AI Agents · Automation · Security

3,860

Open-source agentic security automation platform that runs AI agents and durable workflows at scale with sandboxed execution.

View details
89
Repo Health
88
Technical
66
Dependency
Built with
Python 68%
TypeScript 30%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers