Search code examples
c#emailemail-validation

How to de-duplicate e-mail addresses


Is there a way to reliably get a unique e-mail address from one put in from a user? The problem is services such as GMail allow you to put a period in the address and it's stripped out whereas with other services this is not the case.

GMail:

[email protected]
[email protected]
[email protected]

All of these are the same

Other service:

[email protected]
[email protected]

These are unique.

Other than having special logic specifically for GMail is there a better way?


Solution

  • Each email server will have varying rules about what is, and isn't allowed. You specified you don't want to have specific logic for each client, and for this reason you have to have specific logic.

    You could strip out all dots, but other clients might count dotted email addresses as distinct.

    I would highly recommend not attempting to try this, as it will be a maintenance nightmare, especially when overnight one of the email services changes their policy. Also, the benefits of such a system are small, users would just be motivated to register a new email address which is only marginally more difficult than dotting their actual one.