Sign Up Free

Python Email Verification SDK — Verify Emails in Python

Everything you need to integrate email verification into your application.

Getting Started

The official Python SDK provides synchronous and asynchronous clients for email verification. Supports Python 3.7+ and integrates with Django, Flask, FastAPI, and other frameworks.

Install via pip and verify with clean Pythonic syntax. The async client supports asyncio for high-concurrency apps. The SDK handles rate limiting and retries automatically. Visit our email verifier for no-code verification.

Code Example

pip install ev-email-verifier

from ev_verifier import EmailVerifier

client = EmailVerifier('YOUR_API_KEY')
result = client.verify('user@example.com')

print(result.status)      # "deliverable"
print(result.score)       # 95
print(result.disposable)  # False

# Async usage
import asyncio
from ev_verifier import AsyncEmailVerifier

async def main():
    client = AsyncEmailVerifier('YOUR_API_KEY')
    result = await client.verify('user@example.com')
    print(result.status)

asyncio.run(main())

Authentication & Setup

Install: pip install ev-email-verifier. Set EV_API_KEY environment variable for production. Virtual environment usage is recommended. Supports Django form validators and Flask middleware.

Getting Started

Install the Python email verification SDK by running pip install ev-email-verifier in your terminal. We recommend using a virtual environment to isolate dependencies. The package supports Python 3.7 and above, including the latest Python 3.12 release. For projects using Poetry, run poetry add ev-email-verifier. The SDK uses the requests library for HTTP communication in the synchronous client and aiohttp for the async client. Both dependencies are installed automatically when you install the package.

After installation, import the EmailVerifier class and initialize it with your API key. For production deployments, set the EV_API_KEY environment variable and the SDK will read it automatically without requiring you to pass it in code. The client constructor accepts optional parameters including timeout (default 30 seconds), max_retries (default 3), sandbox mode for testing, and base_url for custom endpoints. The SDK integrates seamlessly with Django, Flask, and FastAPI. For Django, a custom form field validator is included. For Flask, middleware can be added to validate emails on incoming requests automatically.

Code Examples

Single Email Verification

import os
from ev_verifier import EmailVerifier

client = EmailVerifier(api_key=os.environ.get('EV_API_KEY'))

result = client.verify('user@example.com')

print(result.email)        # "user@example.com"
print(result.status)       # "deliverable"
print(result.score)        # 95
print(result.disposable)   # False
print(result.role_account) # False
print(result.mx_found)     # True
print(result.smtp_provider)# "google"

Batch Email Verification

from ev_verifier import EmailVerifier

client = EmailVerifier(api_key='YOUR_API_KEY')

# Submit a batch of emails for verification
emails = ['alice@example.com', 'bob@company.org', 'test@temp-mail.io']
job = client.verify_batch(emails)
print(f"Job ID: {job.id}, Status: {job.status}")

# Wait for completion with polling
results = client.wait_for_batch(job.id, poll_interval=5, timeout=600)

# Analyze results
for result in results:
    print(f"{result.email}: {result.status} (score: {result.score})")

# Filter by status
deliverable = [r for r in results if r.status == 'deliverable']
invalid = [r for r in results if r.status == 'undeliverable']
print(f"Valid: {len(deliverable)}, Invalid: {len(invalid)}")

Async Verification with asyncio

import asyncio
from ev_verifier import AsyncEmailVerifier

async def verify_emails():
    client = AsyncEmailVerifier(api_key='YOUR_API_KEY')

    # Verify single email asynchronously
    result = await client.verify('user@example.com')
    print(f"Status: {result.status}, Score: {result.score}")

    # Verify multiple emails concurrently
    emails = ['alice@example.com', 'bob@company.org']
    tasks = [client.verify(email) for email in emails]
    results = await asyncio.gather(*tasks)

    for r in results:
        print(f"{r.email}: {r.status}")

    await client.close()  # Close the async session

asyncio.run(verify_emails())

Error Handling

The Python SDK raises specific exception classes for different error conditions. The base exception EvError is the parent of all SDK exceptions. AuthenticationError is raised when the API key is invalid or expired. RateLimitError is raised when you exceed your plan's rate limit and includes a retry_after attribute with the number of seconds to wait. ValidationError is raised for malformed email addresses or invalid request parameters. NetworkError covers connection timeouts and DNS resolution failures.

The SDK automatically retries failed requests with exponential backoff for transient errors such as network timeouts and 5xx server responses. You can customize retry behavior by passing max_retries and retry_delay to the client constructor. For batch operations, individual email failures are captured in each result object's error field rather than raising exceptions, so the entire batch continues processing. Use the client.rate_limit_remaining property to monitor your remaining quota and throttle requests proactively before hitting the limit.

from ev_verifier import EmailVerifier
from ev_verifier.exceptions import (
    AuthenticationError, RateLimitError, ValidationError, EvError
)

client = EmailVerifier(api_key='YOUR_API_KEY', max_retries=3)

try:
    result = client.verify('user@example.com')
    print(f"Status: {result.status}")
except RateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after} seconds.")
except AuthenticationError:
    print("Invalid API key. Check your EV_API_KEY environment variable.")
except ValidationError as e:
    print(f"Invalid input: {e.message}")
except EvError as e:
    print(f"Verification failed: {e.message} (code: {e.code})")

Frequently Asked Questions

The SDK supports Python 3.7 and above. It uses the requests library for synchronous calls and aiohttp for async operations. Install with pip install ev-email-verifier. Virtual environment usage is recommended.

Yes, the SDK provides an async client class (AsyncEmailVerifier) that supports asyncio and works with async/await syntax. Use the async client for high-concurrency applications or when integrating with async frameworks like FastAPI or aiohttp.

Yes, the SDK works with any Python web framework. For Django, we provide a ready-made form validator mixin. For Flask, use the synchronous client in route handlers. Example integration code is available in the SDK repository and on this page.

Start Verifying Emails Today

100 daily free verifications. No credit card required. Full API access on all plans. Visit our email verifier to get started.

Try our free email verifier — verify any email instantly, no signup required. Need bulk verification? Upload your list and clean thousands of emails in minutes.

Developers: integrate email verification into your app with our RESTful API — SDKs for 7 languages.

Free tools: SPF checker · DKIM checker · SMTP tester