Gaurav_14 0 Newbie Poster

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.

 TcpClient tClient = new TcpClient("gmail-smtp-in.l.google.com", 25);

     string CRLF = "\r\n";
     byte[] dataBuffer;
     string ResponseString;
    NetworkStream netStream = tClient.GetStream();
     StreamReader reader = new StreamReader(netStream);
    ResponseString = reader.ReadLine();
    /* Perform HELO to SMTP Server and get Response */
     dataBuffer = BytesFromString("HELO KirtanHere" + CRLF);
     netStream.Write(dataBuffer, 0, dataBuffer.Length);
     ResponseString = reader.ReadLine();
    dataBuffer = BytesFromString("MAIL FROM:<YourGmailIDHere@gmail.com>" + CRLF);
     netStream.Write(dataBuffer, 0, dataBuffer.Length);
     ResponseString = reader.ReadLine();
    /* Read Response of the RCPT TO Message to know from google if it exist or not */
     dataBuffer = BytesFromString("RCPT TO:<"+TextBox1.Text.Trim()+">"+CRLF);
     netStream.Write(dataBuffer, 0, dataBuffer.Length);
    ResponseString = reader.ReadLine();
    if (GetResponseCode(ResponseString) == 550)
    {
        Label1.Visible = true;
        Label1.Text = "Mai Address Does not Exist !";
        Label1.Text = "<font color='red'>Original Error from Smtp Server :</font>" + ResponseString;
        //Response.Write("Mai Address Does not Exist !<br/><br/>");
        //Response.Write("<B><font color='red'>Original Error from Smtp Server :</font></b>" + ResponseString);
    }
    else
    {
        Label1.Visible = true;
        Label1.Text = "exist";
        //Response.Write("valid address");
    }
    /* QUITE CONNECTION */
     dataBuffer = BytesFromString("QUITE" + CRLF);
     netStream.Write(dataBuffer, 0, dataBuffer.Length);
     tClient.Close();
 }
 private byte[] BytesFromString(string str)
 {
     return Encoding.ASCII.GetBytes(str);
 }
private int GetResponseCode(string ResponseString)
 {
     return int.Parse(ResponseString.Substring(0, 3));
 }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.