Nu skickar vi mail till deltagarna !
This commit is contained in:
25
TrackerLibrary/EmailLogic.cs
Normal file
25
TrackerLibrary/EmailLogic.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Mail;
|
||||
namespace TrackerLibrary
|
||||
{
|
||||
public static class EmailLogic
|
||||
{
|
||||
public static void SendEmail(List<string> to,string subject, string body)
|
||||
{
|
||||
MailAddress fromMailAddress = new MailAddress(GlobalConfig.AppKeyLookup("senderEmail"), GlobalConfig.AppKeyLookup("senderDisplayName"));
|
||||
MailMessage mail = new MailMessage();
|
||||
to.ForEach(x => mail.To.Add(x));
|
||||
mail.From = fromMailAddress;
|
||||
mail.Subject = subject;
|
||||
mail.Body = body;
|
||||
mail.IsBodyHtml = true;
|
||||
|
||||
SmtpClient client = new SmtpClient();
|
||||
client.Send(mail);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user