disposable_email_domains 0.1.0

A Rust library to detect and block disposable/temporary email addresses during user registration.
Documentation
  • Coverage
  • 50%
    3 out of 6 items documented1 out of 3 items with examples
  • Size
  • Source code size: 15.29 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 28s Average build duration of successful builds.
  • all releases: 28s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • houzhongjian

disposable-email-domains

🛡️ A Rust library to detect and block disposable/temporary email addresses during user registration.

disposable-email-domains is a simple and efficient Rust library that helps developers identify whether an email address belongs to a known disposable (temporary) email provider. This is particularly useful in preventing spam registrations or enforcing real-user policies in your application.

✨ Features

  • 🚀 Fast email domain lookup
  • 🧠 Built-in list of disposable email providers
  • 🔄 Supports automatic updates (optional)
  • ✅ Simple API and easy integration

📦 Installation

Add this crate to your Cargo.toml:

[dependencies]
disposable-email-domains = "0.1"

Or get the latest from GitHub:

[dependencies]
disposable-email-domains = { git = "https://github.com/houzhongjian/disposable-email-domains" }

🔧 Usage

use disposable_email_domains::is_disposable;

fn main() {
    let email = "user@mailinator.com";
    if is_disposable(email) {
        println!("Blocked: Disposable email detected.");
    } else {
        println!("Allowed: Email is not disposable.");
    }
}

Example Output

Blocked: Disposable email detected.

📚 API

is_disposable(email: &str) -> bool

Checks if the provided email address uses a disposable email domain.

  • email: A full email address like example@mailinator.com
  • returns: true if it's disposable, false otherwise.

You can also contribute more domains or override the list if needed.

🤝 Contributing

Contributions, issues, and feature requests are welcome!
Feel free to check the issues page or submit a pull request.

To update the domain list:

cargo run --example update_list

⚖️ License

This project is licensed under the MIT License. See the LICENSE file for details.


Made with ❤️ by Temp Mail