Expand description
RFC 5322 compliant email address validator
This crate provides email validation according to RFC 5322 Section 3.4.1 with support for:
- Standard email addresses (
user@example.com) - Quoted local parts (
"john doe"@example.com) - IP literal domains (
user@[192.168.1.1],user@[IPv6:2001:db8::1]) - All RFC 5322 special characters in local parts
§Examples
use email_validator_rfc5322::{validate_email, is_valid_email};
// Simple validation
assert!(is_valid_email("user@example.com"));
assert!(!is_valid_email("invalid"));
// With error details
match validate_email("user@example.com") {
Ok(()) => println!("Valid email"),
Err(e) => println!("Invalid: {:?}", e),
}§RFC Compliance
This implementation follows:
- RFC 5322: Internet Message Format (email syntax)
- RFC 5321: SMTP (length limits: 64 local, 255 domain, 254 total)
- RFC 1035: DNS (label length limit: 63)
Enums§
- Email
Validation Error - Validation error with detailed information about what failed
Functions§
- is_
valid_ email - Returns
trueif the email address is valid according to RFC 5322 - validate_
email - Validates an email address according to RFC 5322
Type Aliases§
- Validation
Result - Result type for email validation