using System.Net.Mail; using System.Collections.Generic; using System.Linq; namespace Common.Library.Email { public static class EmailExtensions { public static void AddTo(this MailMessage message, List addresses) { addresses.ForEach(address => message.To.Add(address)); } public static void AddBCC(this MailMessage message, List addresses) { if(addresses != null && addresses.Count > 0) { addresses.ForEach(address => message.Bcc.Add(address)); } } public static void AddCC(this MailMessage message, List addresses) { if(addresses != null && addresses.Count > 0) { addresses.ForEach(address => message.CC.Add(address)); } } } }