using System; using EASendMail; void SendTwoMailsInOneConnection() { try { SmtpServer oServer = new SmtpServer("myserveraddress"); // SMTP user authentication oServer.User = "myusername"; oServer.Password = "mypassword"; // Most mordern SMTP servers require SSL/TLS connection now. // ConnectTryTLS means if server supports SSL/TLS, SSL/TLS will be used automatically. oServer.ConnectType = SmtpConnectType.ConnectTryTLS; SmtpClient oSmtp = new SmtpClient(); oSmtp.Connect(oServer); SmtpMail oMail = new SmtpMail("TryIt"); oMail.From = new MailAddress("from@adminsystem.com"); oMail.To.Add(new MailAddress("to@adminsystem.com")); oMail.Subject = "first test email"; oMail.TextBody = "test body"; oSmtp.SendMail(oMail); Console.WriteLine("first sent"); oSmtp.Reset(); oMail.Reset(); oMail.From = new MailAddress("from@adminsystem.com"); oMail.To.Add(new MailAddress("another@adminsystem.com")); oMail.Subject = "second test email"; oMail.TextBody = "another body"; oSmtp.SendMail(oMail); Console.WriteLine("second sent"); oSmtp.Quit(); } catch (Exception exp) { Console.WriteLine("Exception: {0}", exp.Message); } }
The EmailArchitect Support uses cookies. By continuing to browse this site, you are agreeing to our use of cookies. More Details Close