This repo is a golang port of JS library: https://github.com/iDoRecall/email-normalize
normalize-email normalizes email addresses to their canonical form.
- remove dots in GMail or email addresses hosted by similar services (Google Apps for Work, FastMail)
- remove address tags starting with '+', or '-' for Yahoo!, or '=' as well if desired
- converts alias domains to the canonical one, e.g. googlemail.com to gmail
gmail.com
,googlemail.com
andgoogle.com
- the only domains Google is known to use for incoming email- Any domain hosted with Google Apps for Work
- FastMail and domains hosted with FastMail
- Microsoft's outlook.com, hotmail.com, live.com
- Yahoo! domains
// Gmail dots
"[email protected]": "[email protected]",
"[email protected]": "[email protected]",
// Google domains
"[email protected]": "[email protected]",
// Plus
"[email protected]": "[email protected]",
"[email protected]": "[email protected]",
// Non-standard TLDs
"[email protected]": "[email protected]",
// Yahoo!
"[email protected]": "[email protected]",
"[email protected]": "[email protected]",
"[email protected]": "[email protected]",
"[email protected]": "[email protected]",
// Microsoft
"[email protected]": "[email protected]",
"[email protected]": "[email protected]",
"[email protected]": "[email protected]",
"[email protected]": "[email protected]",
// Google Apps for Work
"[email protected]": "[email protected]",
sync version
...
rawEmail := "[email protected]
normEmail := normalize_email.Normalize(rawEmail, nil, nil)
// normEmail == "[email protected]"
...
async version for detect provider
...
callback = make(chan string)
...
rawEmail := "[email protected]
_ := normalize_email.Normalize(rawEmail, &Option{DetectProvider: true}, callback)
...
normEmail := <- callback
// normEmail == "[email protected]"
...
Please also refer normalize_test.go for examples.
_