You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
855 B
C#
30 lines
855 B
C#
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<string> addresses)
|
|
{
|
|
addresses.ForEach(address => message.To.Add(address));
|
|
}
|
|
|
|
public static void AddBCC(this MailMessage message, List<string> addresses)
|
|
{
|
|
if(addresses != null && addresses.Count > 0)
|
|
{
|
|
addresses.ForEach(address => message.Bcc.Add(address));
|
|
}
|
|
}
|
|
|
|
public static void AddCC(this MailMessage message, List<string> addresses)
|
|
{
|
|
if(addresses != null && addresses.Count > 0)
|
|
{
|
|
addresses.ForEach(address => message.CC.Add(address));
|
|
}
|
|
}
|
|
}
|
|
} |