undefined if the given email address is invalid.
import {normalizeEmailAddress} from 'parse-email-address';
const result1 = normalizeEmailAddress('SIMPLE@EXAMPLE.ORG');
// result1 is `'simple@example.org'`
const result2 = normalizeEmailAddress('tld-too-short@foo.x');
// result2 is `undefined`
const result3 = normalizeEmailAddress('"a@b"@example.org');
// result3 is `'"a@b"@example.org'`, which contains two `@`
Normalizes an email address for string comparisons. It is discouraged to use the output of this for sending email as even the weird parts of a valid email address may be required for the user's specific email server to properly handle emails.
This uses
canonicalizefromsmtp-address-parserv1.1.0 and lowercases the entire string. A character is never lowercased across scripts into ASCII, so an address containing U+212A KELVIN SIGN does not normalize to the same string as one containing an ASCIIk.A quoted local part may itself contain an
@, so the output is not safe to split on@. Use parseEmailAddress when you need the domain.