Register now or log in to join your professional community.
email address as usually validated at the application's client side. hence, most of the time; they only check for the email address formats...
but to be able to really check for the existence of an email address, you may have to check at the email address' domain if they do exist...
plus The only way to truly check to see if an email address is valid, is to send an email.
protected bool checkDNS(string host, string recType = "MX")
{
bool result = false;
try
{
using (Process proc = new Process())
{
proc.StartInfo.FileName = "nslookup";
proc.StartInfo.Arguments = string.Format("-type={0} {1}", recType, host);
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.ErrorDialog = false;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.OutputDataReceived += (object sender, DataReceivedEventArgs e) =>
{
if ((e.Data != null) && (!result))
result = e.Data.StartsWith(host);
};
proc.ErrorDataReceived += (object sender, DataReceivedEventArgs e) =>
{
if (e.Data != null)
{
//read error output here, not sure what for?
}
};
proc.Start();
proc.BeginErrorReadLine();
proc.BeginOutputReadLine();
proc.WaitForExit(30000); //timeout after 30 seconds.
}
}
catch
{
result = false;
}
return result;
}
through rcpt to command server and in C# u can create an object of TCP client and NetworkStream and StreamReader to get response it return code may be in case of not exists.