Skip to main content

Crate disposable_emails

Crate disposable_emails 

Source
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 HashSet to 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 true if domain is a known disposable / temp-mail domain.
is_disposable_email
Returns true if the email address’s domain is disposable.