Skip to main content

Check if an email address or domain belongs to a disposable/temporary email service. Bundles 72k+ domains from disposable/disposable-email-domains.

Project description

python-disposable

A lightweight Python package to detect disposable/temporary email addresses. Bundles 72,000+ domains from disposable/disposable-email-domains, updated daily — no network calls at runtime.

Installation

pip install python-disposable

Usage

Basic check

from disposable_email import is_disposable, is_valid

is_disposable("user@mailinator.com")  # True
is_disposable("user@gmail.com")       # False

# Works with bare domains too
is_disposable("guerrillamail.com")    # True

# Inverse
is_valid("user@gmail.com")            # True

Strict mode

Strict mode also flags greylisted domains — services that allow anonymous signups but aren't purely disposable (e.g. some free email providers).

is_disposable("example.com", strict=True)
is_valid("example.com", strict=True)

Subdomain handling

Subdomains are automatically resolved to their parent domain.

is_disposable("mail.mailinator.com")     # True
is_disposable("a.b.guerrillamail.com")   # True

Get the full domain set

from disposable_email import get_domains

domains = get_domains()              # frozenset of 72k+ domains
domains_strict = get_domains(strict=True)  # frozenset of strict list

Domain count

from disposable_email import domain_count

domain_count()              # 72170
domain_count(strict=True)   # 26468

Django example

from django import forms
from disposable_email import is_disposable

class RegisterForm(forms.Form):
    email = forms.EmailField()

    def clean_email(self):
        email = self.cleaned_data["email"]
        if is_disposable(email):
            raise forms.ValidationError("Disposable email addresses are not allowed.")
        return email

API reference

Function Description
is_disposable(email_or_domain, strict=False) Returns True if the email/domain is disposable
is_valid(email_or_domain, strict=False) Returns True if the email/domain is not disposable
get_domains(strict=False) Returns the full frozenset of known disposable domains
domain_count(strict=False) Returns the number of bundled domains

Data source

Domain lists are sourced from disposable/disposable-email-domains and bundled at release time. The upstream list is updated daily via automated scraping of 40+ sources.

This package checks for upstream updates every 4 hours and automatically publishes a new version to PyPI when changes are detected.

License

MIT — see LICENSE.

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

python_disposable-0.0.13.tar.gz (548.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_disposable-0.0.13-py3-none-any.whl (549.3 kB view details)

Uploaded Python 3

File details

Details for the file python_disposable-0.0.13.tar.gz.

File metadata

  • Download URL: python_disposable-0.0.13.tar.gz
  • Upload date:
  • Size: 548.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for python_disposable-0.0.13.tar.gz
Algorithm Hash digest
SHA256 6f68256d405376462967a636b55225b25f9dfec08a7d54978638b34b84aef72f
MD5 1b78ba606e6420a40bda6940de807586
BLAKE2b-256 4b520ab513d1081e03cf46e95d92253755d6e8c269560fd08fca22999d779f69

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_disposable-0.0.13.tar.gz:

Publisher: publish.yml on pescheckit/python-disposable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python_disposable-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for python_disposable-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 6f1abf8f9783d89c49b7ac8934661198ecc827fec1b46243b5afab2710faea3e
MD5 261b3000ae82c92a772b2e39cefee3d7
BLAKE2b-256 0cda103298fa0e3123366e98cfe33dcbca413bb924fc1d6ac7b5ecbe21fcbbd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_disposable-0.0.13-py3-none-any.whl:

Publisher: publish.yml on pescheckit/python-disposable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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