Drop-in replacement for Django's forms.EmailField. Uses http://mailtest.in to validate email addresses against a number of factors. Caches results and fails silently should anything go wrong.
http://mailtest.in is a free email domain validation API. Reject email addresses from invalid domains (i.e. the domain is unregistered or has no MX records). Optionally reject disposable email addresses and monetized bounce services.
You can install django-mailtestfield with pip by typing:
pip install django-mailtestfield
Or with easy_install by typing:
Or manually by downloading a tarball and typing:
python setup.py install
Simply import the form field and use it:
from django import forms from mailtest.fields import EmailMailTestField class MyForm(forms.Form): email = EmailMailTestField()
django-mailtestfield has a few settings with sensible defaults:
MAILTEST_USE_HTTPS Boolean, default
True: Connect to MailTest.in via HTTPS.
MAILTEST_REJECT_DISPOSABLE Boolean, default
True: Reject disposable email addresses.
MAILTEST_REJECT_ROBOT Boolean, default
True: Reject monetized bounce addresses.
MAILTEST_CACHE_AGE Integer, default
86400 (24 hours): Length of time to cache results.
The message strings can also be modifed in the settings.
"This email address is invalid"
"Disposable email addresses are not allowed"
"This email address is blocked"