public void SetRecipients(MessageRecipientType RecipientType, string Recipients)
        {
            // Remove existing recipients of this type
            List <IMessageRecipient> RemovalList = new List <IMessageRecipient>();

            foreach (IMessageRecipient recipient in this)
            {
                if (recipient.RecipientType == RecipientType)
                {
                    RemovalList.Add(recipient);
                }
            }
            foreach (IMessageRecipient recipient in RemovalList)
            {
                this.Remove(recipient);
            }
            if (Recipients != null)
            {
                // Add new recipients
                string[] RecipientList = Recipients.Split(';');
                foreach (string recipient in RecipientList)
                {
                    this.Add(new MessageRecipient(RecipientType, recipient));
                }
            }
        }
        public string GetRecipients(MessageRecipientType RecipientType)
        {
            StringBuilder builder = new StringBuilder();

            foreach (IMessageRecipient recipient in this)
            {
                if (recipient.RecipientType == RecipientType)
                {
                    if (builder.Length > 0)
                    {
                        builder.Append(";");
                    }
                    recipient.ToString(builder);
                }
            }
            return(builder.ToString());
        }
Example #3
0
 public MessageRecipient(string DisplayName, string Address, MessageRecipientType RecipientType) :
     base(DisplayName, Address)
 {
     this.RecipientType = RecipientType;
 }
Example #4
0
 public MessageRecipient(MessageRecipientType RecipientType, string CombinedNameAddress) :
     base(CombinedNameAddress)
 {
     this.RecipientType = RecipientType;
 }
Example #5
0
 public MessageRecipient(string Address, MessageRecipientType RecipientType) : base(null, Address)
 {
     this.RecipientType = RecipientType;
 }