Tutorials to .com

Tutorials to .com » Dotnet » Csharp » E-mail verification with C # class

E-mail verification with C # class

Print View , by: iSee ,Total views: 23 ,Word Count: 4794 ,Date: Wed, 26 Aug 2009 Time: 4:08 AM

/ * E-mail authentication Windows2000, Microsoft.NET Beta2, c # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest . Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1 . ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my @ my . com ")! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc," RCPT TO: "+ strEmail)! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) else (OperaStream (tcpc," QUIT "); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd +" \ r \ n "; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader ( tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C++ # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan ( class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446 @ octopus. cdut.edu.cn "; MyTest.Server =" octopus.cdut.edu.cn "; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, " HELO "+ strServer)! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc," mail FROM: my@my.com ")! =" 250 ") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream ( tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream () ; byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value ;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = " octopus.cdut.edu.cn "; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc . Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") ( OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes ( strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl . Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail. cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false; ) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite , 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;) )) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets ; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;) ) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default) ; sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my @ my.com ")! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc," RCPT TO: "+ strEmail)! =" 250 ") (OperaStream (tcpc , "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n" ; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446 @ octopus.cdut.edu.cn "; MyTest.Server =" octopus.cdut.edu.cn "; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc , "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else ( OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default) ; string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000 @ 126 . com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient () ; tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250" ) (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT"); return false ;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true; )) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default. GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest . Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO: "+ strEmail)! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) else (OperaStream (tcpc," QUIT "); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp ;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net . Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail ;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console . WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding. Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM : my@my.com ")! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc," RCPT TO: "+ strEmail)! =" 250 ") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n "; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft . NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text ; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value; ) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = " zqm446@octopus.cdut.edu.cn "; MyTest.Server =" octopus.cdut.edu.cn "; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc," RCPT TO: "+ strEmail)! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc . GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding. Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000 @ 126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication ( public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest . Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = " 250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc," MAIL FROM: my@my.com ")! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding. Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target : library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;) ) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn" ; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT") ; return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO: "+ strEmail)! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) else (OperaStream (tcpc," QUIT "); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream . Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using system . Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get ( return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, " MAIL FROM: my@my.com ")! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc," RCPT TO: "+ strEmail)! =" 250 ") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n "; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail verification Windows2000 , Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System . Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ()); ) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false ;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email : zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail Verify (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn" ; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT" ); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT") ; return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine ( ); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort ;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu. cn "; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort ); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT "); return false;) if (OperaStream (tcpc," MAIL FROM: my@my.com ")! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc , string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()) ; TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3 ); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream ( ), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc , "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250 ") (OperaStream (tcpc," QUIT "); return false;) else (OperaStream (tcpc," QUIT "); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length ); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * E-mail Verify Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / e-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set ( strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest . Email = "zqm446@octopus.cdut.edu.cn"; MyTest.Server = "octopus.cdut.edu.cn"; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists () );) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine () ; if (OperaStream (tcpc, "HELO" + strServer)! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com") ! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "RCPT TO:" + strEmail)! = "250") (OperaStream (tcpc, "QUIT"); return false;) else (OperaStream (tcpc, "QUIT"); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd + "\ r \ n"; / / Add line breaks Fu TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream ( ), Encoding.Default); string rl = sr.ReadLine (); string sp = rl.Substring (0,3); return sp;))) / * e-mail authentication Windows2000, Microsoft.NET Beta2, C # Made By Qingming Zhao Email: zqm2000@126.com 2002,2,17 csc / target: library ValideEmail.cs * / using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan (class ValidateEmail / / E-mail authentication (public string strEmail; public string strServer; public int intPort; string Email (set (strEmail = value;) get (return strEmail;)) string Server (set (strServer = value;) get (return strServer;)) int Port (set (intPort = value;) get (return intPort;)) / * static void Main (string [] args) (ValidateEmail MyTest = new ValidateEmail (); MyTest.Email = "zqm446@octopus.cdut.edu. cn "; MyTest.Server =" octopus.cdut.edu.cn "; MyTest.Port = 25; / / default port is 25 Console.WriteLine (MyTest.Exists ());) * / public bool Exists () (TcpClient tcpc = new TcpClient (); tcpc.Connect (strServer, intPort); StreamReader sr1 = new StreamReader (tcpc.GetStream (), Encoding.Default); sr1.ReadLine (); if (OperaStream (tcpc, "HELO" + strServer )! = "250") (OperaStream (tcpc, "QUIT"); return false;) if (OperaStream (tcpc, "MAIL FROM: my@my.com")! = "250") (OperaStream (tcpc, " QUIT "); return false;) if (OperaStream (tcpc," RCPT TO: "+ strEmail)! =" 250 ") (OperaStream (tcpc," QUIT "); return false;) else (OperaStream (tcpc," QUIT "); return true;)) static string OperaStream (TcpClient tcpc, string strCmd) (Stream TcpStream; strCmd = strCmd +" \ r \ n "; / / Add line breaks TcpStream = tcpc.GetStream (); byte [] bWrite = Encoding.Default.GetBytes (strCmd.ToCharArray ()); TcpStream.Write (bWrite, 0, bWrite.Length); StreamReader sr = new StreamReader (tcpc.GetStream (), Encoding.Default); string rl = sr. ReadLine(); string sp = rl.Substring(0,3); return sp; } } } /*Windows2000 、Microsoft.NET Beta2、C# Made By Qingming Zhao Email: zqm2000@126.com 2002,2, 17 csc /target:library ValideEmail.cs */ using System; using System.Net.Sockets; using System.IO; using System.Text; namespace BysWangZhan { class ValidateEmail //{ public string strEmail; public string strServer; public int intPort; string Email { set { strEmail=value; } get { return strEmail; } } string Server { set { strServer=value; } get { return strServer; } } int Port { set { intPort=value; } get { return intPort; } } /* static void Main(string[] args) { ValidateEmail MyTest=new ValidateEmail(); MyTest.Email="zqm446@octopus.cdut.edu.cn"; MyTest.Server="octopus.cdut. edu.cn"; MyTest.Port=25; //25 Console.WriteLine(MyTest.Exists()); } */ public bool Exists() { TcpClient tcpc = new TcpClient(); tcpc.Connect(strServer ,intPort); StreamReader sr1 = new StreamReader(tcpc.GetStream(),Encoding.Default); sr1.ReadLine(); if(OperaStream(tcpc,"HELO "+strServer) != "250") { OperaStream(tcpc, "QUIT"); return false; } if(OperaStream(tcpc,"MAIL FROM: my@my.com") != "250") { OperaStream(tcpc,"QUIT"); return false; } if(OperaStream( tcpc,"RCPT TO: "+strEmail) != "250") { OperaStream(tcpc,"QUIT"); return false; } else { OperaStream(tcpc,"QUIT"); return true; } } static string OperaStream( TcpClient tcpc,string strCmd) { Stream TcpStream; strCmd = strCmd + "\r\n"; //TcpStream = tcpc.GetStream(); byte[] bWrite = Encoding.Default.GetBytes(strCmd.ToCharArray( )); TcpStream.Write(bWrite,0,bWrite.Length); StreamReader sr = new StreamReader(tcpc.GetStream(),Encoding.Default); string rl = sr.ReadLine(); string sp = rl.Substring(0 ,3); return sp; } } }


c # (csharp) Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.