It’s a common question : “How can I validate one email address” ?
There are 0b10 (2) types of developers : lazy and ignorant.
- Lazy people always wins, because they do not reinventing the wheel, they prefer to search already done API.
- Ignorant people will probably use Regexp (I love regexp but not in this case) or write a new algorithm, they could spend few hours or days to implement the full RFC, good luck !
So the code is obvisouly server side, and in .net :
using System.Net.Mail;
try { new MailAddress("mail@foo.com"); // You can also use MailAddress.TryCreate from .net Core //here the mail is valid } catch(FormatException ex) { // here the email is invalid }