Article

7 Best Python Libraries for Email Validation in 2026 (Compared)

By Unlimited Verifier Team ·

Diagram of a Python email validation pipeline running syntax, DNS MX, and mailbox checks in sequence.

Summary

The best Python library for most email validation is email-validator, which checks syntax and MX deliverability without contacting the mailbox. For mailbox and catch-all verification at list scale, teams typically pair it with a hosted API, since SMTP probing from your own network is unreliable.

The best Python library to install for most email validation work is email-validator, which checks syntax and DNS deliverability in a few lines with no external service. A library can't reliably confirm that a specific mailbox exists, because that check requires SMTP probes from your own network. For mailbox and catch-all answers on large lists, the practical choice is the hosted Unlimited Verifier REST API, which you call from Python with an API key.

This guide is for Python developers building signup forms and data pipelines, and for marketers, agencies and email verification for SaaS teams who clean large databases from scripts. These groups need different layers, so the list separates format and DNS checks from mailbox checks. For non-Python options, see our roundup of best email verification tools. For the case for checking at the point of entry, start with our pillar on real-time email validation.

Quick answer

Which Python libraries are best for email validation?

The strongest setup for most teams has two layers: a free library for format and DNS checks, plus a hosted service for mailbox and catch-all answers at list scale.

Quick picks

Tool Starting price Free tier Catch-all handling Best for
Unlimited Verifier (REST API) Free; Pro $29/mo or $25/mo billed annually Yes, but no API access on Free Detects catch-all domains and sorts them to Risky Bulk lists and mailbox checks from Python
email-validator Free (open source) Not applicable Not built in Syntax and DNS checks in code
dnspython Free (open source) Not applicable Not built in Custom MX and DNS checks
smtplib Free (standard library) Not applicable You write the probe logic In-house SMTP probing
Pydantic EmailStr Free (open source) Not applicable Not built in Request and model validation
Django EmailValidator Free (part of Django) Not applicable Not built in Forms and model fields
validators Free (open source) Not applicable Not built in Lightweight format checks

Bottom line: use a library for format and DNS checks, and a hosted API when you need mailbox and catch-all answers at list scale.

How we compared (and limitations)

We judged every option on four criteria, based on public documentation, package docs and vendor pages:

  1. Check depth: which layers it covers (syntax, DNS/MX, SMTP mailbox, catch-all, disposable and role-based addresses).
  2. Output: a boolean, an exception, a normalized address, or a risk category.
  3. Operational cost: network requirements, port 25 access, caching, and timeout handling.
  4. Python fit: how cleanly it slots into Django, FastAPI or a plain script.

Limitations. We did not run benchmarks or measure accuracy against real lists. Library behavior can change between versions, so check the version you install. Unlimited Verifier states 99.5% accuracy for deep verification. That is the company's own figure, and we have not independently verified it. No tool can confirm that a catch-all domain's mailbox exists, and none of these libraries detects spam traps or subscriber engagement. This list covers Python only. For other languages, see how to validate email in JavaScript, how to validate email in TypeScript and best Golang email validation packages.

Bottom line: each option is judged on what it checks and what it costs to run, not on a single accuracy claim.

What can a Python email validator actually check?

Email validation happens in layers, and each layer catches different problems. Syntax checks test the address format. RFC 5321 caps the local part at 64 octets and the domain at 255 octets, per the RFC 5321 standard. DNS checks ask whether the domain can receive mail. RFC 5321 also allows a sender to fall back to the domain's A record when no MX record exists. Mailbox checks ask the receiving server whether it will accept mail for a given address, usually with an SMTP RCPT TO command. Catch-all detection asks whether a domain accepts any address, which makes the mailbox check meaningless for that domain.

The distinction that matters most in practice is that syntax-valid is not deliverable. Illustratively, a format check on a 50,000-row list might pass 49,000 rows. The 1,000 rejects are easy to see. The larger risk is the 49,000 that pass format but sit on domains that don't receive mail or contain mailboxes that no longer exist. A format-only library reports all of them as clean.

The stakes are real. Google's sender guidelines ask bulk senders to keep the spam rate in Postmaster Tools below 0.3%, and to aim for under 0.1%. Spam rate measures complaints rather than bounces, but stale addresses can produce both. We recommend the 0.1% figure as your working target.

The standard library's email.utils.parseaddr splits display names from addresses, but it does not validate them, so don't use it as a gate.

Bottom line: a format check is a starting filter. Decide which layers you need, then choose the library that covers them.

The 7 best Python options for email validation, reviewed

1. Unlimited Verifier REST API (best for bulk and catch-all checks from Python)

Unlimited Verifier is a hosted bulk verifier, not a Python package. You call its REST API over HTTP with an API key. It runs syntax, domain, MX and SMTP mailbox checks, detects catch-all domains, and sorts every address into Valid, Risky or Invalid. Because the service handles mailbox checks, you don't need to run SMTP probes from your own network. The company states 99.5% accuracy for deep verification, which is its own figure. It also publishes its open-source verification engine on GitHub, so you can read how the checks are implemented rather than taking them on trust.

Key features

Pros

Cons

Best for: Python teams cleaning lists or batch-verifying signups who want mailbox and catch-all answers without running SMTP themselves.

Where it falls short: if your pipeline must make no external calls at all, a hosted dependency is unavoidable. It also doesn't replace a local format pass, which you should run first.

Pricing: Free ($0) includes 25 lists a month of up to 150 emails each, 750 deep verifications a month, no API access, and 24-hour result retention. Pro is $29/month or $25/month billed annually. It includes unlimited lists of up to 25,000 emails each, 25,000 deep verifications a month, API access (100,000 emails a month) and 30-day result retention. Compare email verification pricing models before committing.

Cost arithmetic. Divided across the full 100,000-email API allowance, the annual Pro price works out to $0.25 per 1,000 emails ($25 ÷ 100). At 60,000 emails a month, the same plan costs about $0.42 per 1,000 ($25 ÷ 60). Use these figures when comparing per-credit vendors. Illustratively, 2,000 signups a day sent as one daily batch uses 60,000 API emails a month, leaving 40,000 for re-verification. Check the email validation API rate limits guide before scheduling large jobs. Generate keys on the Email verification API page, and see email verification API and automation for patterns that fit a Python pipeline.

Tip: Run a local format pass first (script below). Illustratively, if 10% of a 60,000-row export fails format, you save 6,000 API emails for addresses that could actually be delivered.

Bottom line: the right choice when you need mailbox and catch-all answers for lists, as part of a Python workflow.

2. email-validator (the library to install first)

email-validator is an open-source package on PyPI. validate_email() checks syntax against the standards, handles internationalized domain names, and with check_deliverability=True also performs DNS lookups. On success it returns a result with a normalized address. On failure it raises EmailNotValidError, which has subclasses for syntax problems and undeliverable domains, so you can handle the two cases differently.

Key features

Pros

Cons

Best for: signup forms, import scripts and first-pass filtering.

Where it falls short: catch-all domains and mailbox existence.

Pricing: free and open source.

Tip: Cache DNS results by domain in batch jobs. Illustratively, 50,000 rows spread across 8,000 unique domains need 8,000 DNS lookups with a per-domain cache, versus 50,000 without one. Run the DNS step in a background job rather than inside the request, so signup responses stay fast.

Bottom line: the default library for format and DNS checks, not for mailbox verification.

3. dnspython (for custom DNS logic)

dnspython is a general-purpose DNS toolkit. You query MX records with dns.resolver.resolve(domain, "MX") and handle NXDOMAIN, NoAnswer and timeout exceptions. Choose it when you need control that email-validator doesn't expose, such as custom resolvers and timeouts, or reading TXT records for SPF or DMARC. For a walkthrough, see how to check MX records programmatically.

Key features

Pros

Cons

Best for: teams building their own pipeline who want DNS-level policy.

Where it falls short: any question about whether a specific address accepts mail.

Pricing: free and open source.

Tip: Treat NXDOMAIN and timeouts differently. NXDOMAIN is a definitive answer that the domain doesn't exist. A timeout means retry later. Never mark a whole list invalid because of a timeout.

Bottom line: the right tool for custom DNS policy, with the reliability work left to you.

4. smtplib (standard library mailbox probes)

smtplib is Python's built-in SMTP client. A mailbox probe looks like this: resolve the domain's MX host, connect on port 25, send EHLO, MAIL FROM and RCPT TO, read the reply, then quit without ever sending DATA. smtp.rcpt() returns a (code, message) tuple. A 250 or 251 usually means the server accepted the recipient, a 550 usually means rejection, and a 4xx means try again later. Catch-all domains accept almost any recipient, so to detect one you must probe a random address on the same domain. See the smtplib documentation.

Key features

Pros

Cons

Best for: engineers who need in-house probing and accept the operational risk.

Where it falls short: reliability at scale. Read why SMTP email verification gets blocked before you build on it.

Pricing: free. Your real costs are infrastructure, IP reputation and engineering time.

Tip: Test port 25 connectivity before trusting any result. Then use a dedicated sending host with a clear EHLO name, keep concurrency low, and stop on blocking or greylisting responses. Log every code, so you can tell a network block from a genuine rejection.

Bottom line: possible, but you own every operational problem that a hosted API would otherwise absorb.

5. Pydantic EmailStr (for FastAPI and data models)

Pydantic v2 provides EmailStr, a field type that validates format when a model is built. It depends on email-validator, so install it with pip install "pydantic[email]". In FastAPI, a request with an invalid email field returns a 422 error before your handler runs.

Key features

Pros

Cons

Best for: FastAPI and Pydantic signup endpoints.

Where it falls short: deliverability of any kind.

Pricing: free and open source.

Tip: Validate format at the API boundary, then queue a deliverability check for the same address. For the form side, see how to add real-time email verification to signup forms, and client-side vs server-side email validation for where each check belongs.

Bottom line: the cleanest way to enforce format in a FastAPI app, with deliverability handled elsewhere.

6. Django EmailValidator (for forms and models)

Django's EmailValidator is a regex-based validator attached to EmailField in forms and models. You can also call django.core.validators.validate_email directly. It checks the shape of an address but doesn't resolve DNS or contact any server. Most Django projects already have it, so it adds no dependency. See Django's documentation for the current validator options.

Key features

Pros

Cons

Best for: Django apps that need a format gate at signup.

Where it falls short: anything beyond the shape of the address.

Pricing: free, part of Django.

Tip: Wrap it in a custom validator. Call the built-in check first, then a disposable-domain list you maintain. Run the email-validator DNS check in a background task, such as a Celery job, rather than inside the request cycle.

Bottom line: a solid format gate for Django, but never a deliverability check.

7. validators (python-validators)

validators is a small package of format checks, including validators.email(). It returns True for a well-formed address, or a failure object that evaluates as false. It suits quick screening in scripts and CSV cleanup.

Key features

Pros

Cons

Best for: quick format screening in data-cleaning scripts.

Where it falls short: production gates, and anything beyond format.

Pricing: free and open source.

Tip: Run validators and email-validator on a 500-row sample and compare the rejections. Then pick one rule set and use it everywhere, including forms and batch jobs.

Bottom line: handy for screening, provided you standardize on one rule set.

How do you validate a list from Python with Unlimited Verifier?

This workflow runs a free local format pass, then a hosted mailbox check, then a re-import. The Free plan suits testing and small lists. Pro handles full lists and automation.

  1. Export your list as CSV with a column named email. The script below reads that column name. Keep any other columns you want to preserve.
  2. Run the local format pass using the script below. It removes malformed rows before any upload.
  3. Sign up for an account. Free works for lists of up to 150 emails.
  4. Split the file to fit your plan. On Free, each list holds up to 150 emails and you get 25 lists a month. On Pro, each list holds up to 25,000 emails and files must be 10MB or smaller. Then Upload and verify a list. The email column is detected automatically.
  5. Review the three buckets. Valid addresses are candidates for sending, Invalid addresses should be suppressed, and Risky addresses need a segment-level decision.
  6. Spend deep verifications on Risky. Free includes 750 a month and Pro includes 25,000, so save them for rows where the extra check changes the decision.
  7. Download results immediately. Free results are kept for 24 hours and Pro results for 30 days. Export as CSV, Excel or JSON.
  8. Re-import. Mark Valid as active, suppress Invalid, and tag Risky in your system. There are no native integrations, so this step is a file import or an API call.
  9. Automate on Pro. Generate a key, send batches of up to 10,000 emails per request, and stay within the 100,000-a-month API allowance. For one-off checks, use the quick one-off checker.
  10. Repeat on a schedule. Verify new signups weekly and re-verify the full list quarterly. See email list maintenance best practices for the cadence.

Worked example: a 50,000-row list. On Free, 50,000 ÷ 150 rounds up to 334 lists. Free allows 25 lists a month, or 3,750 emails, so the job would take about 14 months (50,000 ÷ 3,750 = 13.3, rounded up). On Pro, 50,000 ÷ 25,000 = 2 lists, which fits in one pass. If 4,000 rows land in Risky, Pro's 25,000 monthly deep verifications cover them easily. Free's 750 would not.

Script for step 2:

import csv
from email_validator import validate_email, EmailNotValidError

with open("list.csv", newline="") as src, \
     open("syntax_ok.csv", "w", newline="") as dst, \
     open("rejects.csv", "w", newline="") as rej:
    reader = csv.DictReader(src)
    writer = csv.DictWriter(dst, fieldnames=reader.fieldnames)
    reject_writer = csv.DictWriter(rej, fieldnames=reader.fieldnames + ["reason"])
    writer.writeheader()
    reject_writer.writeheader()
    for row in reader:
        raw = (row.get("email") or "").strip()
        try:
            validate_email(raw, check_deliverability=False)
            row["email"] = raw
            writer.writerow(row)
        except EmailNotValidError as exc:
            reject_writer.writerow({**row, "reason": str(exc)})

Set check_deliverability=True if you want DNS checks in the same pass, and cache results per domain. Keep the rejects file, so you can review it before deleting anything.

Bottom line: a free local filter, a hosted mailbox check and a re-import keep the expensive checks focused on the rows that need them.

Which Python library should you choose?

Your situation Pick Why
Django signup form Django EmailValidator, plus email-validator for DNS in a background job Format at the form, deliverability off the request path
FastAPI signup endpoint Pydantic EmailStr Automatic 422 responses on bad input
One-time cleanup of a 50,000-row list Local email-validator pass, then Unlimited Verifier Free format filter, hosted mailbox and catch-all checks
Weekly re-verification at scale Unlimited Verifier API on Pro Batches within the monthly allowance
Custom DNS policy dnspython Full control over records and timeouts
In-house mailbox probes smtplib Full control, with port 25 and reputation risk
Quick script screening validators or email-validator One rule set, used consistently

Prevention reduces the cleaning load. For signup-quality tactics, see email list growth strategies.

Bottom line: match the library to the layer you need, and use a hosted API when the question is whether the mailbox exists.

What mistakes do teams make with Python email validation?

Bottom line: most failures come from workflow gaps, such as mixed rules, unchecked timeouts and missing re-verification, rather than from the library itself.

Verdict

For most Python projects, install email-validator for format and DNS checks, and use it in forms, imports and batch jobs. It's free, simple and runs without a third-party service. When you need to know whether mailboxes accept mail, or whether a domain catches everything, a library can't answer that at list scale without SMTP probing. For that, Unlimited Verifier's REST API on Pro, at $25/month billed annually, is the practical choice. It sorts addresses into Valid, Risky and Invalid, flags catch-all domains, and fits a Python batch workflow. Check catch-all email verification and try the free email checker on a sample of your own list before you commit.

Bottom line: combine a free library for format and DNS with a hosted API for mailbox and catch-all answers, and test both on your own data.

Three-layer validation pipeline

Run checks in order, cheapest first:

Layer Tool What it proves Cost
1. Syntax email-validator or validators Address is well-formed Free, local
2. DNS (MX) email-validator or dnspython Domain can receive mail Free, local
3. Mailbox and catch-all Hosted verification API Mailbox likely exists, or domain is catch-all Paid or tiered

Only send addresses that pass layers 1 and 2 to the paid API. This keeps API volume and cost down.

Frequently asked questions

What is the best Python library for email validation?

For most projects, email-validator is the best starting point. It checks email syntax and DNS (MX) deliverability in a few lines of code and runs locally with no external service. It cannot confirm that a specific mailbox exists, so use a mailbox-verification API for that step.

Can a Python library confirm that an email mailbox exists?

Not reliably. Confirming a mailbox requires an SMTP probe from your own network, and many providers and cloud hosts block outbound port 25 or limit probes. Libraries like email-validator only check format and DNS records, so mailbox confirmation usually needs a hosted verification service.

Does email-validator send emails to the address?

No. email-validator performs syntax checks and DNS lookups, including MX record checks, but it never connects to the recipient mailbox. This makes it safe to run on signup forms without generating mail traffic, though it cannot tell you whether a specific inbox is active.

Is smtplib good enough for email verification?

It can perform SMTP probes, but it is harder to make reliable than it looks. Port 25 is often blocked, many servers greylist or rate-limit unknown senders, and catch-all domains accept every address, so results can be misleading. Teams doing this in-house must also manage sender reputation carefully.

What is the difference between email-validator and Django's EmailValidator?

Django's EmailValidator checks that a string matches a valid email format, which is useful for form fields. email-validator goes further by optionally checking DNS and MX records to see whether the domain can receive mail. Use Django's validator for basic form input and email-validator when you need deliverability signals.

Should I use Pydantic EmailStr for email validation?

Use it for request and model validation in FastAPI or Pydantic-based apps. EmailStr relies on the email-validator package for its checks, so install that too. It validates format only and does not confirm that mail can be delivered or that a mailbox exists.

How do I detect catch-all domains in Python?

Standard libraries cannot reliably detect catch-all domains, because those servers accept any address during an SMTP check. You typically need a hosted verification service that tests for catch-all behavior and labels those addresses as risky. Treat catch-all results as uncertain rather than valid.

Which library should I use for bulk email list cleaning in Python?

For large lists, a hosted verification API is usually more practical than building your own probing logic. Use email-validator to filter out malformed addresses and domains without MX records first, then send the remaining addresses to an API for mailbox and catch-all checks. This reduces API usage and cost.

Is email validation with Python free?

The open-source libraries such as email-validator, dnspython, validators, and the smtplib standard library are free to use. Mailbox-level verification usually requires a paid or tiered hosted service, and free tiers often limit volume or exclude API access.

Cut Bounces and Protect Your Sender Reputation With Unlimited Email Verification

Every invalid address you send to hurts your sender reputation and your inbox placement. Verifying your list before each send means fewer bounces, healthier deliverability, and a predictable cost. With Unlimited Verifier, standard verification is unlimited on every plan, with no per-email fees.

Unlimited Verifier checks syntax, domain, MX records and the SMTP mailbox. It also detects catch-all domains and flags disposable and role-based addresses. Export a CSV from your email platform or CRM, upload and verify the list, then re-import the clean results. You can also automate checks with the email verification API.

Free Pro
Price $0 $29/month ($25/month billed annually)
Lists 25 a month, up to 150 emails each Unlimited, up to 25,000 emails each
Deep verifications 750 a month 25,000 a month
API access No Yes (100,000 emails a month)
Result retention 24 hours 30 days

Why teams choose Unlimited Verifier

Unlimited Verifier states 99.5% accuracy for deep verification.

Create a free account and verify your next list before you hit send.

Want to test a single address first? Try the free email checker.