A Rust crate providing an implementation of an RFC-compliant `EmailAddress` newtype.
Rust
94
77 commits
updated Oct 26, 2025
A Rust crate providing an implementation of an RFC-compliant EmailAddress newtype.
Primarily for validation, the EmailAddress type is constructed with
FromStr::from_str which will raise any parsing errors. Prior to constructions
the functions is_valid, is_valid_local_part, and is_valid_domain may also be
used to test for validity without constructing an instance.
Currently, it supports all the RFC ASCII and UTF-8 character set rules as well as quoted and unquoted local parts but does not yet support all the productions required for SMTP headers; folding whitespace, comments, etc.
use email_address::*;
assert!(EmailAddress::is_valid("user.name+tag+sorting@example.com"));
assert_eq!(
EmailAddress::from_str("Abc.example.com"),
Error::MissingSeparator.into()
);
Eq.Option type.Option type documentation.SubDomainEmpty when empty instead of
InvalidCharacter.Thanks to ghandic, blaine-arcjet, Thomasdezeeuw.
PartialEq with case insensitive comparison for
domain part.Hash, because above.new_unchecked to be more flexible.as_str helper method.EmailAddress::new_unchecked function (Sören Meier).Send and Sync implementation, and fixed documentation bug
(Sören Meier).From<EmailAddress> for String.AsRef<str for EmailAddress.local_part and domain accessors.to_uri now supports URI encoding the address as a part of the URI.is_valid_local_part and is_valid_domain methods.domain-literal values, only does surface syntax check.801 followers · starred Nov 2023
1,112 followers · starred Apr 2023
624 followers · starred Sep 2025
81 followers · starred Nov 2023
A Rust crate providing an implementation of an RFC-compliant `EmailAddress` newtype.
Rust
94
77 commits
updated Oct 26, 2025
A Rust crate providing an implementation of an RFC-compliant EmailAddress newtype.
Primarily for validation, the EmailAddress type is constructed with
FromStr::from_str which will raise any parsing errors. Prior to constructions
the functions is_valid, is_valid_local_part, and is_valid_domain may also be
used to test for validity without constructing an instance.
Currently, it supports all the RFC ASCII and UTF-8 character set rules as well as quoted and unquoted local parts but does not yet support all the productions required for SMTP headers; folding whitespace, comments, etc.
use email_address::*;
assert!(EmailAddress::is_valid("user.name+tag+sorting@example.com"));
assert_eq!(
EmailAddress::from_str("Abc.example.com"),
Error::MissingSeparator.into()
);
Eq.Option type.Option type documentation.SubDomainEmpty when empty instead of
InvalidCharacter.Thanks to ghandic, blaine-arcjet, Thomasdezeeuw.
PartialEq with case insensitive comparison for
domain part.Hash, because above.new_unchecked to be more flexible.as_str helper method.EmailAddress::new_unchecked function (Sören Meier).Send and Sync implementation, and fixed documentation bug
(Sören Meier).From<EmailAddress> for String.AsRef<str for EmailAddress.local_part and domain accessors.to_uri now supports URI encoding the address as a part of the URI.is_valid_local_part and is_valid_domain methods.domain-literal values, only does surface syntax check.801 followers · starred Nov 2023
1,112 followers · starred Apr 2023
624 followers · starred Sep 2025
81 followers · starred Nov 2023