private SmtpReply executeCommand(SmtpCommand command) { switch (command.CommandCode) { case "EHLO": return connect(command); case "MAIL": return createMail(command); case "RCPT": return addRecipient(command); case "DATA": return startReadingData(); case "RSET": return interrupt(); case "QUIT": return quit(); } throw new InvalidOperationException("Command Not Understood: " + command.CommandCode); }
private SmtpReply connect(SmtpCommand command) { sender = command.Parameters; return SmtpReply.Ok; }
private SmtpReply createMail(SmtpCommand command) { currentMessage = new SmtpMessage(); currentMessage.From = command.Parameters; return SmtpReply.Ok; }
private SmtpReply addRecipient(SmtpCommand command) { currentMessage.Recipients.Add(command.Parameters); return SmtpReply.Ok; }