46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Mail;
|
|
using System.Web;
|
|
using System.Web.Mvc;
|
|
|
|
namespace Fab2ApprovalSystem.Utilities
|
|
{
|
|
public class EmailUtilities
|
|
{
|
|
// GET: EmailUtilities
|
|
public void SendNotification(string Recep, List<string> ccRecipients, string emailTitle, string email_body, string email_title)
|
|
{
|
|
SmtpClient client = new SmtpClient();
|
|
MailMessage msg = new MailMessage();
|
|
msg.IsBodyHtml = true;
|
|
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
|
msg.Sender = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
|
|
msg.To.Add(Recep);
|
|
//msg.To.Add("Jonathan.Ouellette@infineon.com");
|
|
foreach (string ccRecipient in ccRecipients)
|
|
{
|
|
try
|
|
{
|
|
msg.CC.Add(ccRecipient);
|
|
}
|
|
catch
|
|
{
|
|
Console.WriteLine("Invalid Email Address detected: " + ccRecipient);
|
|
}
|
|
|
|
}
|
|
//msg.CC.Add(recipientCC);
|
|
msg.Subject = email_title;
|
|
msg.Body = email_body;
|
|
|
|
SmtpClient SmtpMail = new SmtpClient("mailrelay-internal.infineon.com");
|
|
|
|
SmtpMail.Send(msg);
|
|
|
|
|
|
}
|
|
}
|
|
}
|