public void BeforeAll() { theServer = EmbeddedSmtpServer.Local(8181); theMessage = new MailMessage("*****@*****.**", "*****@*****.**", "Hello there", "O hai, here is a url for you: http://localhost/something/something/else/is/cool"); theMessage.CC.Add(ccAddress); theMessage.Bcc.Add(bccAddress); theServer.Start(); theClient = new SmtpClient("localhost", theServer.Port); theClient.Send(theMessage); theServer.WaitForMessages(); }
public void BeforeAll() { var port = PortFinder.FindPort(8181); theServer = new EmbeddedSmtpServer(port); theMessage = new MailMessage("*****@*****.**", "*****@*****.**", "Hello there", "O hai"); theMessage.CC.Add("*****@*****.**"); theMessage.Bcc.Add("*****@*****.**"); theServer.Start(); using (var client = new SmtpClient("localhost", port)) { client.Send(theMessage); theMessage.Attachments.Add(new Attachment("Attachment1.txt")); theMessage.Attachments.Add(new Attachment("Attachment2.txt")); client.Send(theMessage); } theServer.Stop(); }
public void BeforeAll() { theServer = EmbeddedSmtpServer.Local(8181); theMessage = new MailMessage("*****@*****.**", "*****@*****.**", "Hello there", "O hai, here is a url for you: http://localhost/something/something/else/is/cool"); theMessage.CC.Add(ccAddress); theMessage.Bcc.Add(bccAddress); theServer.Start(); using (var client = new SmtpClient("localhost", theServer.Port)) { client.Send(theMessage); theMessage.CC.Clear(); client.Send(theMessage); theMessage.Attachments.Add(new Attachment("Attachment1.txt")); theMessage.Attachments.Add(new Attachment("Attachment2.txt")); client.Send(theMessage); } theServer.Stop(); }