private ImapAddressList CreateCollection(string AddressList)
        {
            if (AddressList.ToCharArray()[0] == '(')
            {
                int    num  = 1;
                string temp = "(";
                for (int i = 1; i < AddressList.Length; i++)
                {
                    if (AddressList.ToCharArray()[i] == '(')
                    {
                        num++;
                    }
                    else if (AddressList.ToCharArray()[i] == ')' && num > 1)
                    {
                        num--;
                    }
                    else
                    {
                        temp += AddressList.ToCharArray()[i];
                    }
                }
                AddressList = temp;
            }
            AddressList = Regex.Replace(AddressList, "\\\\\"", "'");
            AddressList = Regex.Replace(AddressList, @"\.\.", ".");
            //if (AddressList.Contains("Carleton"))
            //    throw new Exception();
            ImapAddressList Addresses = new ImapAddressList();
            MatchCollection matches   = Regex.Matches(AddressList, @"\(((?>\((?<LEVEL>)|\)(?<-LEVEL>)|(?! \( | \) ).)+(?(LEVEL)(?!)))\)$");

            foreach (Match match in matches)
            {
                StringBuilder displayName = new StringBuilder("");
                StringBuilder email       = new StringBuilder("");
                string        value       = match.Groups[1].ToString().Trim();
                // Display Name
                if (!(value.StartsWith("NIL")))
                {
                    Match sub;
                    if ((sub = Regex.Match(value, @"^{(\d+)}(.*)")).Success)
                    {
                        value = "\"" + sub.Groups[2].Value.Insert(Convert.ToInt32(sub.Groups[1].Value), "\"");
                    }
                    sub = Regex.Match(value, @"""([^""]+)""");
                    displayName.Append(sub.Groups[1].ToString());
                    value = value.Substring(sub.Length).Trim();
                }
                else
                {
                    value = value.Substring(3).Trim();
                }
                // Display Name Extended
                if (!(value.StartsWith("NIL")))
                {
                    Match sub;
                    if ((sub = Regex.Match(value, @"^{(\d+)}(.*)")).Success)
                    {
                        value = "\"" + sub.Groups[2].Value.Insert(Convert.ToInt32(sub.Groups[1].Value), "\"");
                    }
                    sub = Regex.Match(value, @"""([^""]+)""");
                    displayName.Append(" " + sub.Groups[1].ToString());
                    value = value.Substring(sub.Length).Trim();
                }
                else
                {
                    value = value.Substring(3).Trim();
                }
                // Email Prefix
                if (!(value.StartsWith("NIL")))
                {
                    Match sub;
                    if ((sub = Regex.Match(value, @"^{(\d+)}(.*)")).Success)
                    {
                        value = "\"" + sub.Groups[2].Value.Insert(Convert.ToInt32(sub.Groups[1].Value), "\"");
                    }
                    sub = Regex.Match(value, @"""([^""]+)""");
                    email.Append(sub.Groups[1].ToString());
                    value = value.Substring(sub.Length).Trim();
                }
                else
                {
                    value = value.Substring(3).Trim();
                }
                // Email Suffix
                if (!(value.StartsWith("NIL")))
                {
                    Match sub;
                    if ((sub = Regex.Match(value, @"^{(\d+)}(.*)")).Success)
                    {
                        value = "\"" + sub.Groups[2].Value.Insert(Convert.ToInt32(sub.Groups[1].Value), "\"");
                    }
                    sub = Regex.Match(value, @"""([^""]+)""");
                    email.Append("@" + sub.Groups[1].ToString());
                    value = value.Substring(sub.Length).Trim();
                }
                else
                {
                    value = value.Substring(3).Trim();
                }
                if (email.ToString().IndexOf('@') < 0)
                {
                    email = new StringBuilder("undisclosed-recipients@localhost");
                }
                ImapAddress address = new ImapAddress(email.ToString(), ImapDecode.Decode(displayName.ToString()));
                Addresses.Add(address);
                return(Addresses);
            }
            return(Addresses);
        }
 /// <summary>
 /// Creates an instance of the ImapAddressCollection class.
 /// </summary>
 public ImapAddressCollection()
 {
     To  = new ImapAddressList();
     CC  = new ImapAddressList();
     BCC = new ImapAddressList();
 }