disposable-emails 0.1.1

Fast, zero-allocation disposable / temporary email domain detection with an embedded 72k-domain blocklist.
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented3 out of 4 items with examples
  • Size
  • Source code size: 1.19 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 259.82 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • j-mendez

disposable-emails

Fast, zero-allocation disposable / temporary email domain detection for Rust.

Tells you whether an email address — or just its domain — belongs to a disposable / temp-mail provider (Mailinator, Guerrilla Mail, 10MinuteMail, and ~72,000 others). Useful for blocking throwaway inboxes from sign-up flows, free-trial farming, and per-account abuse.

[dependencies]
disposable-emails = "0.1"
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 ~72k-domain blocklist is compiled into a sorted &'static [&'static str] by the build script. There is:

  • no heap allocation — the list lives in the binary's read-only segment; no HashSet is built,
  • no startup cost — nothing is parsed or loaded at runtime,
  • an O(log n) binary-search lookup (~17 comparisons).

The only per-call allocation is a small lowercase copy of the input domain.

API

Function Description
is_disposable_email(&str) -> bool Domain of the address is disposable. Malformed input → false.
is_disposable_domain(&str) -> bool The domain is disposable. Case-insensitive; tolerates a trailing ..
domain_count() -> usize Size of the embedded blocklist.

The blocklist

domains.txt is a vendored copy of the community-maintained disposable aggregate. To refresh it, replace that file and rebuild — the build script re-sorts and de-duplicates.

no_std is not required to be off — the crate is #![forbid(unsafe_code)] and depends only on core/alloc-level std.

Licence

Dual-licensed under either of Apache-2.0 or MIT, at your option.