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

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_disposable-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 18486e46b32b268c6d09e4ca53d4e739febdedcbdf1fd8637100a75d868ff2d7
MD5 841c2cc5053b450047e83512e22531e0
BLAKE2b-256 398d83cb192a249887978a7a72664e2fbab8a00b2c1a898ed0476927dd0a9e58

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for python_disposable-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 134a1303b29f4b13469232d75b4cc3464a961fda312df0dd76e6ca55d4cdee3c
MD5 62ba03556d669b00f14d2e2c6862ee86
BLAKE2b-256 ee3fc88ad2af312aa4c2d89aec17d6aaad1efd6cc9b169f23df911af70f18e8d

See more details on using hashes here.

Provenance

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