Abhilash J A

Abhilash J A

  • 533
  • 2.4k
  • 598k

how to email verification in c#?

Feb 28 2017 4:17 AM
Hello everyone,
 
I am working on MVC 5, I want to verify Email ID.
 
1) I am now validating email addres using jquery.
 
  1. function isEmail(email) {     
  2.     var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;  
  3.     return regex.test(email);  

 2) And checking the email id is existing or not inside database.
  1. [HttpPost]  
  2.        public bool UserEmailIDExist(string emailid)  
  3.        {  
  4.            if (IsValidEmail(emailid) == true)  
  5.            {  
  6.                PartnerBIL partnerBIL = new PartnerBIL();  
  7.                return partnerBIL.SearchCompanyname(emailid);  
  8.            }  
  9.            else {  
  10.                return true;  
  11.            }  
  12.        }  
  13.   
  14.        public bool IsValidEmail(string email)  
  15.        {  
  16.           /*Here, Which code I use for validate email id?*/  
  17.        } 
  Also I want to verify the email id is valid online, how can I do that?
 
Please help me...

Answers (9)