initial add
This commit is contained in:
45
Fab2ApprovalSystem/Utilities/EmailUtilities.cs
Normal file
45
Fab2ApprovalSystem/Utilities/EmailUtilities.cs
Normal file
@ -0,0 +1,45 @@
|
||||
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-external.infineon.com");
|
||||
|
||||
SmtpMail.Send(msg);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user