There are multiple ways to produce email address Strings that differ with straight String comparison (see below), but are logically equivalent (i.e. mail sent to both goes to same mail box). This often allows users to give seemingly unique email addresses, even if strict equality was disallowed.
I was hoping to find a library that would try to do normalization, to allow for finding some of duplicates from large sets of email addresses. Goal here is to find as many duplicates as possible. Given how useful this is for multiple purposes (in my case it is simple abuse detection, as abuse accounts tend to (try to) just reuse certain accounts), I am thinking there might be existing solutions.
So what kind of things can vary? I know of at least things like:
- domain name part is case-insensitive (as per DNS); but local part may or may not be, this depends on mail provider (for example, Gmail considers it case-insensitive)
- many domains have aliases (googlemail.com is equivalent to gmail.com)
- some email providers allow other variations that they ignore (gmail, for example, ignores any dots in email address!)
Ideally this would be in Java, although scripting languages would also work (command-line tool)