https://github.com/asaph/emailnormalizer
Normalize Email Addresses e.g. a.b.c@gmail.com -> abc@gmail.com or abc+def@gmail.com -> abc@gmail.com
https://github.com/asaph/emailnormalizer
Last synced: about 1 year ago
JSON representation
Normalize Email Addresses e.g. a.b.c@gmail.com -> abc@gmail.com or abc+def@gmail.com -> abc@gmail.com
- Host: GitHub
- URL: https://github.com/asaph/emailnormalizer
- Owner: asaph
- Created: 2019-02-09T18:32:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-20T22:37:09.000Z (over 6 years ago)
- Last Synced: 2025-01-28T14:47:51.129Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Email Normalizer
==
This library normalizes email addresses. Some providers allow users to modify their email addresses
in ways that make them appear to be different addresses when in fact they still deliver to the same
mailbox.
For example, Gmail supports 2 varieties of ad-hoc email address modifications which will still deliver
mail to the same address.
1. Dots may be inserted arbitrarily into the username portion of any Gmail email address. e.g. Email sent to `a.b.c@gmail.com` gets delivered to the same mailbox as email sent to `abc@gmail.com`.
2. A `+` followed by an arbitrary suffix may be appended to the username portion of any Gmail email address. e.g. Email sent to `abc+def@gmail.com` gets delivered to the same mailbox as email sent to `abc@gmail.com`.
Usage:
--
```java
import static org.asaph.emailnormalizer.EmailNormalizer.*;
// ...
String email = "a.b.c@gmail.com";
String normalizedEmail = normalizeEmail(email);
System.out.println(normalizedEmail); // outputs abc@gmail.com
// another example
String anotherEmail = "abc+def@gmail.com";
String anotherNormalizedEmail = normalizeEmail(anotherEmail);
System.out.println(anotherNormalizedEmail); // outputs abc@gmail.com
```