Exemplo n.º 1
0
        /// <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());
        }
Exemplo n.º 2
0
        /// <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);
        }