Esempio n. 1
0
        private void ExcludeMailboxes(MailAddressList recipients, string addrStr)
        {
            if (string.IsNullOrEmpty(addrStr))
            {
                return;
            }

            var addresses = MailboxList.Parse(addrStr);

            foreach (Mailbox address in addresses)
            {
                recipients.Remove(address);
            }
        }
Esempio n. 2
0
        private IEnumerable <Mailbox> RemoveMailbox(IEnumerable <Mailbox> source, string email)
        {
            email = email.With(_ => _.Trim());
            var addresses = new HybridDictionary();

            if (!string.IsNullOrEmpty(email))
            {
                foreach (Mailbox mailbox in MailboxList.Parse(email))
                {
                    if (!string.IsNullOrEmpty(mailbox.Address))
                    {
                        addresses.Add(mailbox.Address.ToLower(), mailbox);
                    }
                }
            }
            foreach (Mailbox item in source)
            {
                if (addresses.Count == 0 || !addresses.Contains(item.Address.ToLower()))
                {
                    yield return(item);
                }
            }
        }