Category : .Net | Author : Chtiwi Malek | First posted : 12/11/2012 | Updated : 1/15/2013
Tags : email, validate, verify, check, test, components, .net
Free Asp.Net Email Validator/Verifier

Free Asp.Net Email Validator/Verifier

If you need to check if an email address really exists, this .Net component is for you.

How it works :

This free email validator/verifier component will check if an email address really exists by finding the mx records of the domain name, connecting to the mailbox’s smtp server and simulating the sending of an email (without really sending an email) and will test if a positive response is received to validate the address.

Features :

• Check Email Syntax (An accurate syntax check)
• Check if a domain name has MX records
• Read Mx records (get the mx records for a domain name or an email adress)
• Check SMTP Server (verify that the SMTP server is working and accept connections)
• Check Mailbox validity (connect to an email server directly via SMTP to check if mailbox is valid)

This component requires the Microsoft .NET framework and can be used in your website (webforms) or application (winforms).

Add a reference to the dll (or copy the file E-mail_Validator.dll to your bin directory)

It does not have a GUI front end, it is a component that can only be accessed programmatically, just create an instance :
Codicode.EmailValidator EV = new Codicode.EmailValidator();

please note that some mail servers always return a positive response even if the mailbox doesn’t exist.

C# code sample :

The following code will verify the validity of the email address, if no error was returned, then the email address is valid and can accept mails, if not and error message will be returned (account dosn't exist, no mx records, smtp timeout ...)
// We create an instance of our eMail-Validator Object
Codicode.EmailValidator Ev = new Codicode.EmailValidator();

// Set the Sender email (for smtp identification)
Ev.Mail_From = "";
// Check if the email address is valid and really exists
string errorMsg = Ev.Check_MailBox_Error(tbEmail.Text);

if (errorMsg == "")
      // the Mail Address/Smtp is valid and running
      lbStatus.Text = "Mail OK";
      // An error occured while validating the email
      lbStatus.Text = errorMsg;

// Close and Dispose

The following code will retrive the MX records list from an email's domain name :

// We create our eMail Validator Object
Codicode.Emailvalidator Ev = new Codicode.Emailvalidator();

// Get the domain's MX records
string[] Mx_Records = Ev.FindMXRecords(tbEmail.Text);
About the author :
Malek Chtiwi is the man behind
34 years old full stack developer.
Loves technology; but also likes design, photography and composing music.
Comments & Opinions :
Email Validator
Check_Mailbox function always return false (frame work 3.5)  for valied entry. Can u plz guide me
- by Solgin on 1/14/2013
use the Check_MailBox_Error function instead.
- by Chtiwi Malek on 2/8/2013
Hi! Apart from this Codi Code Email Verify website we can download DLL from the below mentioned website. Any how when we extract the Zip folder we found DLLs which supports according to .Net Framework Versions ie., .Net2.0,.Net3.0,.Net3.5,.Net4.0,.Net4.5. Actually the example that has provided in ZIP file is working fine for single email(provided in textbox). To check for Multiple emails see below code which is to be provided at Mainform.cs. Example: My database has 12,219 email. To check these emails I'm changing code in button click event like private void btnVerify_Click(object sender, EventArgs e) { // Update the UI // btnVerify.Enabled = txtEmailAddress.Enabled = false; // btnVerify.Text = "Working..."; // First lines of the log ClearLog(); Log("Verification started."); // Start the asynchronous verification process string s = "SELECT Email from SalesForceData1 WHERE Email Not in(select Email from SalesForceData1 where Email like '')"; da = new SqlDataAdapter(s, con); ds = new DataSet(); da.Fill(ds, "SalesForceDate1"); for (int i =958; i <= ds.Tables[0].Rows.Count-1;i++) { var verification = new Verification(ds.Tables[0].Rows[i]["Email"].ToString()); // MessageBox.Show(ds.Tables[0].Rows[i].ToString()); // var verification = new Verification(txtEmailAddress.Text); //TimeSpan span = new TimeSpan(0, 0, 0, 30, 0); //verification.Settings.DnsReceiveTimeout.TotalSeconds = span.TotalSeconds; var requiredLevel = ((VerificationLevelComboItem)cbLevel.SelectedItem).VerificationLevel; verificationEngine.BeginRun(verification, requiredLevel, ar => { // Complete the asynchronous validation VerificationEngine.EndRun(ar); // Update the UI Invoke(new MethodInvoker(() => { Log(String.Format("Verification completed. Last status: {0}", verification.State.Result.LastStatus)); // MessageBox.Show(verification.InputData+" "+verification.State.Result.LastStatus.ToString()); // MessageBox.Show("Failure"); con.Open(); SqlCommand cmd = new SqlCommand("usp_DAG_UpdateEmailStatus", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Email", verification.InputData); cmd.Parameters.AddWithValue("@Status", verification.State.Result.LastStatus.ToString()); cmd.ExecuteNonQuery(); string sucess = "SELECT count(Email) as Count from SalesForceData1 WHERE EmailStatus='Success'"; string totalcount = " SELECT count(Email) as Count from SalesForceData1"; SqlDataAdapter da1 = new SqlDataAdapter(sucess, con); DataSet ds1 = new DataSet(); DataSet ds2 = new DataSet(); da1.Fill(ds1); lblSuccessCount.Text = ds1.Tables[0].Rows[0]["Count"].ToString(); SqlDataAdapter da2 = new SqlDataAdapter(totalcount, con); da2.Fill(ds2); lblTotalCount.Text = ds2.Tables[0].Rows[0]["Count"].ToString(); con.Close(); // btnVerify.Enabled = txtEmailAddress.Enabled = true; // btnVerify.Text = "Verify"; })); }, null); } } Note:- Appropriate Dlls are gets registered as Public ie.,using GACUTIL.exe tool. These DLLS are not working for YAHOO domain email ids.
- by Siddendra Prasad on 6/27/2014
Msn live doesn't work
no msn or live account works with this dll,But the work is really good,can I have the codes ?
- by Shad on 1/24/2013
Getting 003 : No MX records found
I am getting   003 : No MX records found error even i gave correct mail address while using 3.5 framework dll in my web application. What is the reason for that? But in your site its working fine.
- by Mahesh on 2/26/2013
Yes its not working at all
- by Nimesh on 8/16/2013
I'm getting same Time out:000 error for all email address, even for good emails.. anyone got solution?
- by Vanam on 4/3/2014
Getting 003: No MX records found error for all my emails i validate (yahoo, google, whatever)
- by Helga on 8/25/2014
I'm getting the 003 as well.  I trapped the call and it's abending with a "No connection could be made because the target machine actively refused it".  I've tried port 25, 587, 2525 & 465.
- by Steve on 8/14/2015
For framework 3,5 ,its not working, throughing error.
      Its not perfrct code for the framework 3.5, its not validating the email.


- by shivanand on 3/7/2013
I am Getting 003: No MX records found error
I am Getting 003: No MX records found error for all my emails i validate (Gmail, google, whatever).i gave correct mail address while using 4.0 framework .
- by Dharmendar Singh on 9/28/2015
Email checking
It's good but
Where is Codicode class and where is the method EmailValidator
- by Sudheer on 1/5/2016
Leave a Comment:
Name :
Email : * will not be shown
Title :
Comment :