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.12.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.12-py3-none-any.whl (549.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_disposable-0.0.12.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.12.tar.gz
Algorithm Hash digest
SHA256 735cccf2db4daaa3101ae12b7dfb01bef1459228c5a31a64d67895edf046e89f
MD5 f55d93364437b355a8cee4a687af46bc
BLAKE2b-256 761b509963986e069c4a88ce55a7ff2138de303eb803f45d01bae0b4913533dd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for python_disposable-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 74d12c205366d2a89e601181c6defa517d041fcacbcedc4d6e15c004dac6944b
MD5 2ca02be76c13c2b65653754cf4295141
BLAKE2b-256 6dbc21f66eb624d08b426dc284efec599e00c86e52807fcb2c7d3471b4a4cfc0

See more details on using hashes here.

Provenance

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