Disposable / Temporary Email Domain Detection Regex for Java
/@(?: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 Java. 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 Java project — whether you're validating in a Spring Boot controller, a Jakarta EE service, or a standalone utility class.
Java Implementation
// Disposable / Temporary Email Domain Detection
// ReDoS-safe | RegexVault — Identity & PII > Email Address
import java.util.regex.Pattern;
public class DisposableTemporaryEmailDomainDetectionValidator {
private static final Pattern PATTERN =
Pattern.compile("@(?: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)$");
public static boolean validate(String input) {
return PATTERN.matcher(input).matches();
}
// Example
public static void main(String[] args) {
System.out.println(validate("test@mailinator.com")); // true
}
}Test 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 Java developers because critical in Java applications since the JVM regex engine uses backtracking and is susceptible to ReDoS without careful pattern design. 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