The `disposable-email-domains` Python library provides a collection of known disposable and temporary email address domains. It's designed to help applications identify and block registrations or interactions from email addresses often used for spam, abuse, or privacy-conscious temporary sign-ups. The list is periodically updated, with the current version being 0.0.169, reflecting changes from the primary `disposable-email-domains` project. [1, 4]
pip install disposable-email-domainsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import the `blocklist` set and check if a given email address's domain is present within it. It's crucial to convert the domain to lowercase for an accurate check, as all domains in the `blocklist` are lowercase. [4]
Regularly update the library to the latest version (`pip install --upgrade disposable-email-domains`). For critical applications requiring real-time accuracy, combine this library with an external email validation API that offers dynamic updates and deeper checks. [3, 10, 19]
For comprehensive email validation, combine the use of this `blocklist` with other validation steps, such as regex for format checking, MX record lookups, and optionally, real-time mailbox verification services. [18]
Always convert the domain part of an email address to lowercase (e.g., `email_address.split('@')[-1].lower()`) before checking if it is in the `disposable_email_domains.blocklist`.Install the library using pip: `pip install disposable-email-domains`
Import the `blocklist` set and use the `in` operator for checking: `from disposable_email_domains import blocklist; domain_to_check = 'example.com'; is_disposable = domain_to_check.lower() in blocklist`
Access the `blocklist` set and perform a case-insensitive check directly: `from disposable_email_domains import blocklist; email_domain = 'TestMail.com'; if email_domain.lower() in blocklist: print('Disposable domain detected.')`No dependency data recorded yet.