private static void SendMail(EmailParts ep) {//, List<EmailAttachment> attachments) { Email mail = new Email(); int smtpPort; if (String.IsNullOrEmpty(_EmailFrom)) { throw new Exception("Please provide an email address for the EmailFrom setting in the web.config file"); } int.TryParse(System.Configuration.ConfigurationManager.AppSettings["SMTPPort"], out smtpPort); mail.SMTPHost = System.Configuration.ConfigurationManager.AppSettings["SMTPHost"]; mail.SMTPPort = smtpPort; mail.FromAddress = _EmailFrom; mail.AddToAddresses(ep.ToAddresses); mail.AddCCAddresses(ep.CcAddresses); mail.AddBCCAddresses(ep.BccAddresses); mail.Subject = ep.Subject; mail.Body = ep.Body; //if a log of emails being sent from this application is beneficial, uncomment the following line and add any conditional checking if content security/privacy is of concern //LogEmailAttempt(ep); //if (attachments != null && attachments.Count > 0){ // mail.SendAttachment(attachments); //}else{ mail.SendMail(); //} }