Disposable.Email
1.0.0
dotnet add package Disposable.Email --version 1.0.0
NuGet\Install-Package Disposable.Email -Version 1.0.0
<PackageReference Include="Disposable.Email" Version="1.0.0" />
paket add Disposable.Email --version 1.0.0
#r "nuget: Disposable.Email, 1.0.0"
// Install Disposable.Email as a Cake Addin #addin nuget:?package=Disposable.Email&version=1.0.0 // Install Disposable.Email as a Cake Tool #tool nuget:?package=Disposable.Email&version=1.0.0
Disposable 📧
A high-performance .NET library for validating disposable/temporary email domains. Built with performance and efficiency in mind, it provides a simple way to check if an email address or domain is from a known disposable email provider.
Overview
The Disposable library offers:
- High Performance: Uses
Span<T>
and aggressive inlining for optimal performance - Memory Efficient: Operates on string spans to minimize allocations
- Up-to-date Domain List: Uses the comprehensive domain list from disposable/disposable
- Simple API: Just two static methods to validate emails or domains
- Zero Dependencies: No external package dependencies
- Lightweight: Minimal memory footprint
Getting Started
Installation
Install the Disposable package:
dotnet add package Disposable
Basic Usage
using Disposable;
// Check an email address
bool isDisposable = EmailValidator.IsDisposable("user@tempmail.com");
// Check a domain directly
bool isDomainDisposable = DomainValidator.IsDisposable("tempmail.com");
Features
Email Validation
The EmailValidator
class provides methods to validate if an email address uses a disposable domain:
// Using string
bool result1 = EmailValidator.IsDisposable("user@example.com");
// Using ReadOnlySpan<char> for better performance
ReadOnlySpan<char> email = "user@example.com";
bool result2 = EmailValidator.IsDisposable(email);
Domain Validation
The DomainValidator
class allows direct domain checking:
// Using string
bool result1 = DomainValidator.IsDisposable("example.com");
// Using ReadOnlySpan<char> for better performance
ReadOnlySpan<char> domain = "example.com";
bool result2 = DomainValidator.IsDisposable(domain);
Performance Considerations
- Uses
ReadOnlySpan<char>
to minimize allocations - Aggressive inlining with
MethodImplOptions.AggressiveInlining
- Efficient domain parsing and validation
- Zero heap allocations for common operations
Domain List Source
The disposable domain list is generated from the disposable/disposable project, specifically using their domains.txt file. This ensures the library stays current with the latest known disposable email providers.
Requirements
- .NET 7.0 or higher
- C# 11.0 or higher
License
This library is available under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and feature requests, please open an issue in the GitHub repository.
Thank you for using Disposable. We look forward to seeing how you use it in your projects!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 98 | 12/3/2024 |