Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.IsValidEmail() reporting incorrect results #27

Open
jasenf opened this issue Oct 15, 2019 · 4 comments · May be fixed by #28
Open

.IsValidEmail() reporting incorrect results #27

jasenf opened this issue Oct 15, 2019 · 4 comments · May be fixed by #28
Assignees

Comments

@jasenf
Copy link

jasenf commented Oct 15, 2019

String extension method .IsValidEmail() is incorrectly reporting e-mails such as

[email protected]

as invalid. This is a valid RFC e-mail address, and one recommended by Google to alias existing inboxes.

@JonathanMagnan JonathanMagnan self-assigned this Oct 16, 2019
@JonathanMagnan
Copy link
Member

Hello @jasenf ,

Do you have a proposal to the Regex we should use? Last time I made a research about it, pretty much all regex has some flaw and it seems there is no consensus about which Regex to use.

Best Regards,

Jonathan


Performance Libraries
context.BulkInsert(list, options => options.BatchSize = 1000);
Entity Framework ExtensionsEntity Framework ClassicBulk OperationsDapper Plus

Runtime Evaluation
Eval.Execute("x + y", new {x = 1, y = 2}); // return 3
C# Eval FunctionSQL Eval Function

@jasenf
Copy link
Author

jasenf commented Oct 16, 2019

I think it's fine as-is if you just allow the + sign.

@JonathanMagnan
Copy link
Member

We will try to review it soon by using the syntax from here: https://en.wikipedia.org/wiki/Email_address

It will not be perfect but we will change the regex to at least contains printable characters (which contains the plus sign)

@dmarciano
Copy link

If you really want to make it validate email addresses, RegularExpressions probably isn't the way to go. The simplest way to cover everything would probably be to just try creating a new MailAddress object and catch if an exception is thrown OR re-implement the code that does the email address validation from the .NET framework (https://github.com/microsoft/referencesource/blob/master/System/net/System/Net/mail/MailAddressParser.cs)

@Huntk23 Huntk23 linked a pull request Dec 17, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants