1. Creating the C# Function Check Email Syntax
Create a public C# Function called "VerifyEmailSyntax"
public static bool VerifyEmailSyntax(string email)
{
try
{
string pattern =
@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
if ((Regex.IsMatch(email, pattern)))
return true;
else
return false;
}
catch (Exception)
{
return false;
}
}