我正在尝试使用以下方法检查 smtp 服务器。
似乎工作正常,但我的防病毒软件有阻止警报。
无论如何要检查防病毒软件是否被阻止然后停止 smtp 检查?
谢谢。
public static bool Check(string host, string port, string username, string password)
{
TcpClient tcpClient = new TcpClient();
tcpClient.Connect(host, Convert.ToInt32(port));
NetworkStream netStream = tcpClient.GetStream();
System.IO.StreamReader strReader = new System.IO.StreamReader(netStream);
byte[] WriteBuffer = new byte[1024];
ASCIIEncoding enc = new System.Text.ASCIIEncoding();
WriteBuffer = enc.GetBytes("USER " + username + "\r\n");
netStream.Write(WriteBuffer, 0, WriteBuffer.Length);
WriteBuffer = enc.GetBytes("PASS " + password + "\r\n");
netStream.Write(WriteBuffer, 0, WriteBuffer.Length);
if (strReader.ReadLine().Contains("+OK"))
{
return true;
}
return false;
}