Disposable / Temporary Email Domain Detection Regex for Python
/@(?:mailinator|guerrillamail|tempmail|throwam|yopmail|maildrop|sharklasers|guerrillamailblock|grr|spam4|trashmail|dispostable|spamgourmet|10minutemail|tempinbox|mailnull|spambog|getairmail|getnada|spam\.la|mailexpire)\.(?:com|net|org|me|io)$/iWhat this pattern does
This page provides a comprehensive, battle-tested regular expression for matching disposable / temporary email domain detection, ported and verified for Python. Identity and credential patterns need both correctness and safety, since they're frequent targets for adversarial input. The snippet below is ready to drop into your Python project — whether you're validating in a Django view, a FastAPI endpoint, or a standalone data processing script.
Python Implementation
# Disposable / Temporary Email Domain Detection
# ReDoS-safe | RegexVault — Identity & PII > Email Address
import re
disposable_temporary_email_domain_detection_pattern = re.compile(r'@(?:mailinator|guerrillamail|tempmail|throwam|yopmail|maildrop|sharklasers|guerrillamailblock|grr|spam4|trashmail|dispostable|spamgourmet|10minutemail|tempinbox|mailnull|spambog|getairmail|getnada|spam\.la|mailexpire)\.(?:com|net|org|me|io)$')
def validate_disposable_temporary_email_domain_detection(value: str) -> bool:
return bool(disposable_temporary_email_domain_detection_pattern.fullmatch(value))
# Example
print(validate_disposable_temporary_email_domain_detection("test@mailinator.com")) # TrueTest Cases
Matches (Valid) | Rejects (Invalid) |
|---|---|
test@mailinator.com | user@gmail.com |
user@guerrillamail.com | user@example.com |
abc@yopmail.com | user@outlook.com |
x@tempmail.com | — |
When to use this pattern
This pattern is drawn from the Identity & PII > Email Address category and carries a ReDoS-safe certification. That matters for Python developers because particularly important in Python web servers where CPU-bound regex operations can stall concurrent request handling. RegexVault audits patterns against known backtracking attack vectors, ensuring you have the necessary context before using this regex in a high-stakes production environment.
Common Pitfalls
Some legitimate use cases exist for disposable emails (e.g., security researchers testing). A blocklist approach is more maintainable than regex — regex is only suitable for a fixed set of known domains.
Technical Notes
This is a partial list — the disposable email ecosystem changes constantly. Use a maintained blocklist (e.g., disposable-email-domains GitHub repo) rather than a static regex. New domains appear regularly.
Have a pattern that belongs in the vault?
Submit it for review — community-verified patterns get credited to your GitHub handle. Free submissions join the queue. Priority review available for $15.
Submit a Pattern