public void SetUp() { theSession = MockRepository.GenerateStub<ISmtpSession>(); theHandler = new HeloHandler(); theToken = new SmtpToken(); theSession.Stub(x => x.RemoteAddress).Return("1234"); }
public void SetUp() { theSession = MockRepository.GenerateStub <ISmtpSession>(); theHandler = new HeloHandler(); theToken = new SmtpToken(); theSession.Stub(x => x.RemoteAddress).Return("1234"); }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { if(token.Command == Recipient) { var rawAddress = token.Data.ValueFromAttributeSyntax(); // <*****@*****.**> session.AddRecipient(rawAddress.Replace("<", "").Replace(">", "")); } session.WriteResponse("250 Ok"); return ContinueProcessing.Continue; }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { if (token.Command == Recipient) { var rawAddress = token.Data.ValueFromAttributeSyntax(); // <*****@*****.**> session.AddRecipient(rawAddress.Replace("<", "").Replace(">", "")); } session.WriteResponse("250 Ok"); return(ContinueProcessing.Continue); }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { _messageGatherer.AppendLine(token.Data); if (token.Data != null && token.Data.Trim() == ".") { session.WriteResponse(string.Format("250 Ok: queued as {0}", Guid.NewGuid())); session.SaveMessage(CreateMessage(_messageGatherer, session)); token.IsMessageBody = false; } return(ContinueProcessing.Continue); }
public MailMessage CreateMessage(StringBuilder builder, ISmtpSession session) { var message = new MessageParser().Parse(builder.ToString()); // Any recipients that are registered but haven't been used are blind copies session .Recipients .Where(x => !message.To.Any(y => y.Address == x) && !message.CC.Any(y => y.Address == x)) .Each(x => message.Bcc.Add(x)); return message; }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { _messageGatherer.AppendLine(token.Data); if(token.Data != null && token.Data.Trim() == ".") { session.WriteResponse(string.Format("250 Ok: queued as {0}", Guid.NewGuid())); session.SaveMessage(CreateMessage(_messageGatherer, session)); token.IsMessageBody = false; } return ContinueProcessing.Continue; }
public MailMessage CreateMessage(StringBuilder builder, ISmtpSession session) { var message = new MessageParser().Parse(builder.ToString()); // Any recipients that are registered but haven't been used are blind copies session .Recipients .Where(x => !message.To.Any(y => y.Address == x) && !message.CC.Any(y => y.Address == x)) .Each(x => message.Bcc.Add(x)); return(message); }
public void SetUp() { theHandler = new MessageParsingHandler(); theMessageBody = new StringBuilder(); theMessageBody.AppendLine("MIME-Version: 1.0"); theMessageBody.AppendLine("From: [email protected]"); theMessageBody.AppendLine("To: [email protected], [email protected]"); theMessageBody.AppendLine("Cc: [email protected]"); theMessageBody.AppendLine("Subject: This is a test"); theMessageBody.AppendLine("Content-Type: text/plain; charset=us-ascii"); theMessageBody.AppendLine("Content-Transfer-Encoding: quoted-printable"); theMessageBody.AppendLine(); theMessageBody.AppendLine("This is the body"); theMessageBody.AppendLine().AppendLine(".").AppendLine(); theRecipients = new List <string>(); theSession = MockRepository.GenerateStub <ISmtpSession>(); theSession.Stub(x => x.Recipients).Return(theRecipients); theMessage = theHandler.CreateMessage(theMessageBody, theSession); }
public void SetUp() { theHandler = new MessageParsingHandler(); theMessageBody = new StringBuilder(); theMessageBody.AppendLine("MIME-Version: 1.0"); theMessageBody.AppendLine("From: [email protected]"); theMessageBody.AppendLine("To: [email protected], [email protected]"); theMessageBody.AppendLine("Cc: [email protected]"); theMessageBody.AppendLine("Subject: This is a test"); theMessageBody.AppendLine("Content-Type: text/plain; charset=us-ascii"); theMessageBody.AppendLine("Content-Transfer-Encoding: quoted-printable"); theMessageBody.AppendLine(); theMessageBody.AppendLine("This is the body"); theMessageBody.AppendLine().AppendLine(".").AppendLine(); theRecipients = new List<string>(); theSession = MockRepository.GenerateStub<ISmtpSession>(); theSession.Stub(x => x.Recipients).Return(theRecipients); theMessage = theHandler.CreateMessage(theMessageBody, theSession); }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { session.WriteResponse("221 Bye"); return(ContinueProcessing.Stop); }
public void SetUp() { theSession = MockRepository.GenerateStub<ISmtpSession>(); theHandler = new QuitHandler(); theToken = new SmtpToken(); }
public void SetUp() { theSession = MockRepository.GenerateStub <ISmtpSession>(); theHandler = new RegisterAddressesHandler(); theToken = new SmtpToken(); }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { session.WriteResponse("354 End data with ."); token.IsMessageBody = true; return(ContinueProcessing.Continue); }
public void SetUp() { theSession = MockRepository.GenerateStub<ISmtpSession>(); theHandler = new RegisterAddressesHandler(); theToken = new SmtpToken(); }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { session.WriteResponse(string.Format("250 Hello {0}, I am glad to meet you", session.RemoteAddress)); return ContinueProcessing.Continue; }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { session.WriteResponse("221 Bye"); return ContinueProcessing.Stop; }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { session.WriteResponse("354 End data with ."); token.IsMessageBody = true; return ContinueProcessing.Continue; }
public ContinueProcessing Handle(SmtpToken token, ISmtpSession session) { session.WriteResponse(string.Format("250 Hello {0}, I am glad to meet you", session.RemoteAddress)); return(ContinueProcessing.Continue); }
public void SetUp() { theSession = MockRepository.GenerateStub <ISmtpSession>(); theHandler = new DataHandler(); theToken = new SmtpToken(); }