Skip to main content

Python class for use with Django to detect Disposable Emails

Project description

Python class for use with Django to detect Disposable Emails. Checks each email against a blacklist of ~890 domains used by various disposable email services.

Installation

It’s an ordinary Python package, just install via pip:

$ pip install git+ssh://git@github.com/aaronbassett/DisposableEmailChecker.git

Download the example disposable email domains list or create your own and update settings.py:

$ cd /usr/share/
$ wget https://raw.github.com/aaronbassett/DisposableEmailChecker/master/disposable_email_domains.txt

Required Setting

Add the following setting to your Django settings.py:

DISPOSABLE_EMAIL_DOMAINS = "/usr/share/disposable_email_domains.txt"

Usage

To use the checker in your own scripts:

>>> from disposable_email_checker import DisposableEmailChecker

>>> email_checker = DisposableEmailChecker()
>>> email_checker.is_disposable("foo@guerrillamail.com")
True

Using with Django

To use the checker during form validation, normally in forms.py:

from django import forms
from django.utils.translation import ugettext_lazy as _
from disposable_email_checker import DisposableEmailChecker


class MyForm(forms.Form):
    email = forms.EmailField(label=_('Email'))

    def clean_email(self):
        email_checker = DisposableEmailChecker()
        if email_checker.is_disposable(email):
            raise forms.ValidationError(_('Please use a different email address provider.'))

        return email

License

MIT: http://aaron.mit-license.org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

File details

Details for the file django-disposable-email-checker-0.1.1.tar.gz.

File metadata

File hashes

Hashes for django-disposable-email-checker-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ae381a3efa9865b477fb8f55a8f62ddee395cbded43d32f2045470f3cc6f7757
MD5 ef842da50085ecce6ac72627638257bb
BLAKE2b-256 6979de4242e2425e368cb55ec69148d203774365355057ca368193f703be859f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page