protected void OnSmtpCommandReceived(SmtpCommandReceivedEventArgs e) { if (CommandReceived != null) { CommandReceived(this, e); } }
private void Init() { this.LineReceived += (object sender, TcpRequestHandler.TcpLineReceivedEventArgs e) => { Console.WriteLine("SmtpRequestHandler => line received: " + e.Line); Match statusMatch = Regex.Match(e.Line.Trim(), "^([0-9]+)\\s+(.+)", RegexOptions.Compiled); try { if (statusMatch.Success) { int status = Convert.ToInt32(statusMatch.Groups[1].Value); SmtpCommandReceivedEventArgs eventArgs; switch (status) { case 220: // Server bereit eventArgs = new SmtpCommandReceivedEventArgs(status, statusMatch.Groups[2].Value.Trim()); break; default: eventArgs = new SmtpCommandReceivedEventArgs(status, statusMatch.Groups[2].Value.Trim()); break; } this.OnSmtpCommandReceived(eventArgs); } } catch (Exception) { } }; }
private void Init() { this.LineReceived += (object sender, TcpRequestHandler.TcpLineReceivedEventArgs e) => { Console.WriteLine("SmtpRequestHandler => line received: " + e.Line); Match statusMatch = Regex.Match(e.Line.Trim(), "^([0-9]+)\\s+(.+)", RegexOptions.Compiled); try { if (statusMatch.Success) { int status = Convert.ToInt32(statusMatch.Groups[1].Value); SmtpCommandReceivedEventArgs eventArgs; switch(status) { case 220: // Server bereit eventArgs = new SmtpCommandReceivedEventArgs(status, statusMatch.Groups[2].Value.Trim()); break; default: eventArgs = new SmtpCommandReceivedEventArgs(status, statusMatch.Groups[2].Value.Trim()); break; } this.OnSmtpCommandReceived(eventArgs); } } catch(Exception) { } }; }