/// <summary> /// returns the ; delimited list of recipients /// </summary> /// <returns>A list of strings representing each recipient</returns> public static List <string> GetRecipients(this IPersistableEmailMessage source) { if (source is null) { throw new System.ArgumentNullException(nameof(source)); } return(string.IsNullOrWhiteSpace(source.Recipients) ? new List <string>() : source.Recipients.Split(';').Where(r => !string.IsNullOrWhiteSpace(r)).ToList()); }
/// <summary> /// Adds new recipients to the message /// </summary> /// <param name="NewRecipients">The recipients to add</param> public static void AddRecipients(this IPersistableEmailMessage source, params string[] NewRecipients) { if (source is null) { throw new System.ArgumentNullException(nameof(source)); } List <string> oldList = source.GetRecipients(); oldList.AddRange(NewRecipients.ToList()); source.Recipients = string.Join(";", oldList); }