Click or drag to resize
Simple Email Address Validation
The following example validates a single email address to the MXValidateLevel.Mailbox level.
[C#]
using System;
using Neev Software.ASPNET.Components ; 
namespace EmailValidatorDemo
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	class Class1
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main(string[] args)
		{
			try
			{
			
			EmailAddressValidator  e = new EmailAddressValidator();
			
			e.DnsServer = "69.50.184.85";
			e.SmtpFromEmail = "yourcompany@yourcompany.com";
			e.SmtpFromDomain = "mail.yourcompany.com";
			e.UseMXCach = true;						
						
			e.Validate("yourname@company.com");			 
			Console.WriteLine("Server: {0}", e.SmtpTranscript ); 	
				
			Console.ReadLine(); 
			}
			catch(Exception ex)			
			{
			Console.WriteLine("Server: {0}",ex.ToString()  ); 
			Console.ReadLine(); 
			}

		}
	}
}
[Visual Basic]
Imports System;
Imports Neev Software.ASPNET.Components ; 

module EmailValidatorDemo
		sub Main()
		
			try
			Dim EmailAddressValidator   =  new EmailAddressValidator()

			e.DnsServer = "69.50.184.85"
			e.SmtpFromEmail = "yourcompany@yourcompany.com"
			e.SmtpFromDomain = "mail.yourcompany.com"
			e.UseMXCach = true						
						
			e.Validate("yourname@company.com")		 
			Console.WriteLine("Server: {0}", e.SmtpTranscript ) 	
				
			Console.ReadLine();
			
				
			catch Exception ex 
			
			Console.WriteLine("Server: {0}", ex.ToString()  )
			Console.ReadLine()
			end try
			
		end sub

	
end module
See Also