By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

About the MX Record Entry of particular hotmail,yahoomail and rediffmail provider

P: 8
I am designing one web page which checks the existence of the Email Address on the server

For that I have the following code.....this code checks the the existence of gmail address for

e.g xxxx@gmail.com on the Gmail server

so can anyone please tell me what is the MX Record Entry of Hotmail,Yahoomail and Rediffmail provider.

Expand|Select|Wrap|Line Numbers
  1. TcpClient tClient = new TcpClient("gmail-smtp-in.l.google.com", 25);
  2.  
  3.      string CRLF = "\r\n";
  4.      byte[] dataBuffer;
  5.      string ResponseString;
  6.     NetworkStream netStream = tClient.GetStream();
  7.      StreamReader reader = new StreamReader(netStream);
  8.     ResponseString = reader.ReadLine();
  9.     /* Perform HELO to SMTP Server and get Response */
  10.      dataBuffer = BytesFromString("HELO KirtanHere" + CRLF);
  11.      netStream.Write(dataBuffer, 0, dataBuffer.Length);
  12.      ResponseString = reader.ReadLine();
  13.     dataBuffer = BytesFromString("MAIL FROM:<YourGmailIDHere@gmail.com>" + CRLF);
  14.      netStream.Write(dataBuffer, 0, dataBuffer.Length);
  15.      ResponseString = reader.ReadLine();
  16.     /* Read Response of the RCPT TO Message to know from google if it exist or not */
  17.      dataBuffer = BytesFromString("RCPT TO:<"+TextBox1.Text.Trim()+">"+CRLF);
  18.      netStream.Write(dataBuffer, 0, dataBuffer.Length);
  19.     ResponseString = reader.ReadLine();
  20.     if (GetResponseCode(ResponseString) == 550)
  21.     {
  22.         Label1.Visible = true;
  23.         Label1.Text = "Mai Address Does not Exist !";
  24.         Label1.Text = "<font color='red'>Original Error from Smtp Server :</font>" + ResponseString;
  25.         //Response.Write("Mai Address Does not Exist !<br/><br/>");
  26.         //Response.Write("<B><font color='red'>Original Error from Smtp Server :</font></b>" + ResponseString);
  27.     }
  28.     else
  29.     {
  30.         Label1.Visible = true;
  31.         Label1.Text = "exist";
  32.         //Response.Write("valid address");
  33.     }
  34.     /* QUITE CONNECTION */
  35.      dataBuffer = BytesFromString("QUITE" + CRLF);
  36.      netStream.Write(dataBuffer, 0, dataBuffer.Length);
  37.      tClient.Close();
  38.  }
  39.  private byte[] BytesFromString(string str)
  40.  {
  41.      return Encoding.ASCII.GetBytes(str);
  42.  }
  43. private int GetResponseCode(string ResponseString)
  44.  {
  45.      return int.Parse(ResponseString.Substring(0, 3));
  46.  }
Mar 6 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.