Hi Team
I need some help, i have a logic that attempts to send email notification to group user, so far its not working and need help.
public static class EmailNotificationToUser
{
public static void SendEmail(string htmlString,string emailGrp)
{
try
{
MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
message.From = new MailAddress("[email protected]");
List<MailAddress> addresses = new List<MailAddress>();
emailGrp += "[email protected]";
emailGrp.Split(',').Select(i => new MailAddress(i)).ToArray();
message.To.Add(emailGrp);
message.Subject = "ShopFloor AMS Incident Report";
message.IsBodyHtml = true;
message.Body = htmlString;
smtp.Port = 587;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("[email protected]", "Telkom800@@");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);
}catch(Exception ex)
{
}
}
}