Nu skickar vi mail till deltagarna !

This commit is contained in:
2020-04-16 23:21:34 +02:00
parent 7f4bf45850
commit 5d0d891024
7 changed files with 160 additions and 20 deletions

View 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);
}
}
}