Disposable / Temporary Email Domain Detection Regex for Go
/@(?: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 Go. 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 Go project — whether you're validating in a Gin handler, a gRPC service, or a command-line tool.
Go Implementation
// Disposable / Temporary Email Domain Detection
// ReDoS-safe | RegexVault — Identity & PII > Email Address
package validation
import "regexp"
var disposableTemporaryEmailDomainDetectionRe = regexp.MustCompile(`@(?: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)$`)
func ValidateDisposableTemporaryEmailDomainDetection(s string) bool {
return disposableTemporaryEmailDomainDetectionRe.MatchString(s)
}
// Example
// fmt.Println(ValidateDisposableTemporaryEmailDomainDetection("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 Go developers because Go's RE2 engine is inherently safe from catastrophic backtracking, but this pattern has been additionally verified for correctness. 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