public static void SendEmail(string[] emailAddresses, string body, string subject) { try { using (var client = new SmtpServiceClient("basicHttpEndPoint")) { var oMessage = new SmtpMessage { From = AppConfig.FromAddress, Body = body, IsBodyHtml = true, Subject = subject, To = emailAddresses.ToArray() }; try { client.Send2(oMessage); } catch (Exception exception) { LogEvent(exception, EventLogEntryType.Error); } } } catch (Exception exception) { LogEvent(exception, EventLogEntryType.Error); } }
public static void SendEmail(string messageBody, string toAddress, string subject) { using (var client = new SmtpServiceClient("basicHttpEndPoint")) { var oMessage = new SmtpMessage { From = String.Format("{0}@SARS.GOV.ZA", SARSDataSettings.Settings.ApplicationName).ToUpper(), Body = messageBody, IsBodyHtml = true, Subject = subject, To = new[] { toAddress } }; client.Send2(oMessage); } }
public static void SendEmail(string[] emailAddresses, string body, string subject) { using (var client = new SmtpServiceClient("basicHttpEndPoint")) { var oMessage = new SmtpMessage { From = Configurations.FromAddress, Body = body, IsBodyHtml = true, Subject = subject, To = emailAddresses.ToArray() }; client.Send2(oMessage); client.Close(); } }