Expand description
Disposable / temporary email domain detection.
Tells you whether an email address (or just its domain) belongs to a disposable / temp-mail provider — the throwaway inboxes used to farm free trials, dodge per-account limits, and spam sign-up flows.
use disposable_emails::{is_disposable_email, is_disposable_domain};
assert!(is_disposable_email("someone@mailinator.com"));
assert!(is_disposable_domain("guerrillamail.com"));
assert!(!is_disposable_email("jeff@gmail.com"));§Why it’s cheap
The ~72,000-domain blocklist is compiled into a sorted
&'static [&'static str] by the build script. That means:
- zero heap allocation — the list lives in the binary’s read-only
segment; there is no
HashSetto build, - zero startup cost — nothing is parsed or loaded at runtime,
- lookups are an
O(log n)binary search (~17 comparisons).
The only allocation per call is a small lowercase copy of the input domain (tens of bytes).
§The list
domains.txt is a vendored copy of the community-maintained
disposable
aggregate. Refresh it by replacing that file and rebuilding.
§Licence
Dual-licensed under Apache-2.0 OR MIT.
Functions§
- domain_
count - The number of disposable domains in the embedded blocklist.
- is_
disposable_ domain - Returns
trueifdomainis a known disposable / temp-mail domain. - is_
disposable_ email - Returns
trueif the email address’s domain is disposable.