Normalize the part after @ without lowercasing the mailbox name or removing its +tag.
dotnet add package RecursiveAI.OneContactRequires .NET 10 (net10.0); .NET 9 and earlier aren’t supported.
using RecursiveAI.OneContact; var email = EmailAddress.Parse( "Casey+news@EXAMPLE.COM"); Console.WriteLine(email.Canonical);
Unzip the example, then dotnet run.
Casey+news@example.comFull program
using RecursiveAI.OneContact; string[] inputs = [ "Casey+news@EXAMPLE.COM", "Casey <Casey+news@Bücher.example>", "\"A@B\"@EXAMPLE.COM", "Casey@example..com", ]; foreach (string input in inputs) { if (EmailAddress.TryParse(input, out var email)) Console.WriteLine(email.Canonical); else Console.WriteLine($"Invalid mailbox syntax: {input}"); }
dotnet run prints:
Casey+news@example.com Casey+news@xn--bcher-kva.example "A@B"@example.com Invalid mailbox syntax: Casey@example..com
TryParse returns false for malformed input such as Casey@example..com, whose domain has an empty label. This is a syntax check, not a check that the domain or mailbox can receive mail.
Variations
Read just the domain when you need it as a separate field. Domain gives the ASCII form; UnicodeDomain gives the Unicode form for display:
using RecursiveAI.OneContact; var email = EmailAddress.Parse( "Casey@Bücher.example"); Console.WriteLine(email.Domain); Console.WriteLine(email.UnicodeDomain);
xn--bcher-kva.example bücher.example
Related recipes
The short answer
In C#, parse one mailbox with EmailAddress.Parse and use Canonical for the normalized address. OneContact lowercases the domain and converts internationalized domain labels to ASCII. It doesn’t lowercase the local part or apply provider-specific alias rules. If you only want the normalized domain, read Domain instead.
Do capital letters make a difference in an email address?
It depends on which side of @ you mean. RFC 5321, section 2.4 says mailbox domains aren’t case-sensitive, but SMTP implementations must preserve the local part’s case. That’s why the first example changes EXAMPLE.COM to example.com but keeps Casey. Don’t lowercase the entire input as a shortcut.
The local part can also contain a quoted @, as in the third input of the full program. The parser keeps the quotes and the @ inside them. It reads one mailbox and can take it from Display Name <address>, but the display name isn’t part of Canonical. As the email docs explain, canonicalization also removes comments, folding and whitespace around dots; it isn’t a byte-for-byte copy of everything before the domain.
How do you normalize an internationalized email domain?
For a domain such as Bücher.example, Domain returns xn--bcher-kva.example. This ASCII form uses IDNA (Internationalized Domain Names in Applications). The parser checks the domain labels as it processes them, so invalid ones don’t turn into a canonical address. The IDNA docs explain the rules. An ASCII domain does not make the whole address ASCII: a non-ASCII local part is a separate matter and needs SMTPUTF8 for delivery.
Does plus addressing work for all emails?
Don’t assume it does. The receiving system determines what + means in a local part. Canonical keeps Casey+news intact; it doesn’t decide that it reaches the same mailbox as Casey. OneContact also exposes an email comparison key with different rules, including some provider-specific handling. Use the canonical address for domain normalization, not the comparison key. Keep address normalization separate from any decision to treat two addresses as interchangeable.