/// <summary> /// Base send method to decide how to handle the mail based on which environment we're in /// </summary> /// <param name="mailToSend"></param> private static void EnvironmentSend(cfEmail mailToSend) { if (Stgs.IsDevelopmentEnvironment) { string filePath = string.Format(Stgs.DebugMailDir + "debug.html"); File.WriteAllText(filePath, mailToSend.Body); } else { MailMessage mail = new MailMessage(Stgs.MailMan, mailToSend.To); mail.ReplyToList.Add(mailToSend.ReplyTo); mail.Subject = mailToSend.Subject; mail.Body = mailToSend.Body; mail.IsBodyHtml = true; Stgs.MailServer.Send(mail); } }
//--------------------------------------------------------------------------------// //- createAndSendMail is for single mail messages that need to //- be sent straight away //--------------------------------------------------------------------------------// public static void PostSingleMail(cfEmail mailToSend) { EnvironmentSend(mailToSend); }