public static void sendEmail(List<string> to, string message, string subject = "System Notification") { message = message.Replace("<br>", "/n"); try { var email = new globals.emailMessage(); Task.Run(() => { foreach (var e in to) { try { email = new globals.emailMessage(); email.to = e; email.message = message; email.subject = subject; globals.sendEmail(email); } catch (Exception ex) { globals.logdata(ex.Message); } } }); } catch (Exception ex) { logdata(ex + ""); } }
public static void emailNotifcation(string to,string from,string message, HostingEnvironment host) { var email = new globals.emailMessage(); email.to = to; email.subject = "New Messgae Notification"; var emsg = System.IO.File.ReadAllText(host.WebRootPath + "/emialViews/email_notification.html"); emsg = emsg.Replace("{{message}}", "Good day, You have a new message from " + from + "<br>: " + message); email.message = emsg; globals.sendEmail(email); }