我正在尝试检查电子邮件地址是否存在。我可以@gmail.com
根据 SMTP 服务器验证地址gmail-smtp-in.l.google.com
,但我不知道如何获取其他域的 SMTP 服务器以进行检查。请告知如何获取域的 SMTP 服务器,或者另一种可靠地检查电子邮件地址是否存在的方法。
这是我检查@gmail.com
地址的代码:
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 AnkurHere" + CRLF);
netStream.Write(dataBuffer, 0, dataBuffer.Length);
ResponseString = reader.ReadLine();
dataBuffer = BytesFromString("MAIL FROM:<abc@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.Text = "Mai Address Does not Exist !";
label2.Text = "Original Error from Smtp Server" + ResponseString;
}
/* QUITE CONNECTION */
dataBuffer = BytesFromString("QUITE" + CRLF);
netStream.Write(dataBuffer, 0, dataBuffer.Length);
tClient.Close();