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.11.tar.gz (548.3 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.11-py3-none-any.whl (549.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_disposable-0.0.11.tar.gz
  • Upload date:
  • Size: 548.3 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.11.tar.gz
Algorithm Hash digest
SHA256 ef6e2fad414b6dd9902652634abdd4da8b05ffb9c378d83f8ce402eb071f7162
MD5 ea08e29aea25e078dfe18ba8af15c5e8
BLAKE2b-256 38444e6173459e5164051695eade98b981c5856ad5751de68537a7fd1bdc5c58

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_disposable-0.0.11.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.11-py3-none-any.whl.

File metadata

File hashes

Hashes for python_disposable-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 871e6b0e04050e556bec84e8713bac39002e413ffd275d862ad388f3cc508f51
MD5 9d950b64eeb00a54a278ef09d9f705fd
BLAKE2b-256 1053452950973099d3df965ac6bcd9060413cd02f70d5424a19d41b50e02df0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for python_disposable-0.0.11-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