jstedfast / EmailValidation

A simple (but correct) .NET class for validating email addresses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to find out the reason why the mail is invalid?

reponemec opened this issue · comments

Is it possible to find out the reason why the mail is invalid? Some friendly message...
Thanks.

I suppose so. How detailed do you need it to be?

Supposing "invalid" address "john gray@domain.com". Then the validation error could be:

{
    "Code": "InvalidCharacter",
    "Description": "Invalid character {0} at {1}.",
    "Params": [" ", 4]
}

Translatable. Inspired a bit by IdentityError: https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.identityerror?view=aspnetcore-7.0