Integrations
Django integration
A validator, a form field and a model field for Django that fail an email address that cannot receive mail. They check each address once, and let a real person sign up when the API cannot answer in time.
- Status: Setup guide
- A Python package for your project
from django import forms
from email_validation_django import DeliverableEmailFormField
class SignupForm(forms.Form):
email = DeliverableEmailFormField()At a glance.
- Status
- Setup guide. Not listed on a marketplace yet: you set it up yourself in a few steps, below and in the full guide.
- For
- Django developers who want sign-up, contact and checkout forms, and models saved through full_clean(), to refuse the addresses that will bounce.
- You need
- Django 4.2 or newer on Python 3.10 or newer, the package file from the guide, and an API key made for it, with a daily credit cap, set in your environment as
EV_API_KEY. - Costs
- 1 credit = 1 validated address, as with any API request. Free: unknown results, API errors, malformed addresses and test addresses on sandbox.email-validation.org.
- Full guide
- Read the full setup guide
Typical uses.
A form field
DeliverableEmailFormField is forms.EmailField plus the check, which runs once the format is right. A malformed address is refused by Django’s own check and never sent.
A model field
DeliverableEmailField is models.EmailField, checked in full_clean() and in model forms, so every model form that saves the field gets the check too.
The validator on any field
Add validate_email_deliverable to any field’s validators, or a DeliverableEmailValidator with its own fail_on statuses and messages, for example a stricter one for work addresses.
Set it up. 5 steps.
The short version of the full setup guide, which stays the reference when a step does not match what you see.
Download the package
The package is not on PyPI yet: download the file from the guide, and commit it to your repository if you want it in your requirements.
Install it
Install the file into your project’s environment with
pip installand its path; pip also installs Django and the Python client library. Nothing goes inINSTALLED_APPS.Set your key
Create an API key with Validate addresses and a daily credit cap, and set it in your environment as
EV_API_KEY, never in code.Use a field
Use
DeliverableEmailFormField()for a form’s email field, orDeliverableEmailField()for a model’s.Try it
Submit
accepted@sandbox.email-validation.org, which passes, andno_mailbox@sandbox.email-validation.org, which fails. Test addresses cost nothing.
Good to know.
- Only
invalidfails by default. Set"BLOCK_DISPOSABLE": Trueto faildisposableaddresses as well;catch_allandunknownpass unless you add them toFAIL_ON. - When the check cannot finish (a timeout, an unreachable API, a 5xx or 429 answer, no credits or no key), the address passes and a warning with the error code and request id goes to the package’s logger, never the address. Set
"FAIL_OPEN": Falseto fail the field instead. - Each result is kept in Django’s cache for an hour, under a SHA-256 hash of the address, so a form sent again after fixing another field is not checked or charged again. Only the status is kept, and unknown results are not kept at all.
- The messages are translatable, and each error has a code for your templates or API responses:
email_invalid,email_disposable,email_catch_all,email_unknownandemail_unavailable. - For EU data residency, set
"BASE_URL"inEMAIL_VALIDATIONtohttps://api-eu.email-validation.org: the same key works on both.
Updated · Maintained by the email-validation.org team