Is Valid Email : Mail « Network « C# / C Sharp






Is Valid Email

  

using System.Text.RegularExpressions;

public class Base
{

    private static bool isValidEmail(string email)
    {
        Regex r = new Regex(@"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$");

        if (!string.IsNullOrEmpty(email))
            return r.IsMatch(email);
        else
            return false;
    }
}

   
    
  








Related examples in the same category

1.SmtpClient: From, Subject, Body, Attachments, To
2.Mail Test
3.A POP3 e-mail checkerA POP3 e-mail checker
4.Fancy Mail Test
5.Mail Attach Test
6.Send Email
7.Send HTML Mail
8.Is Valid Email Address
9.Is Email
10.Sends a MailMessage object using the SMTP settings.
11.Smtp Send