/// <summary> /// Quickly create a search query specifying the display name and/or email address for the BCC: field /// </summary> /// <param name="name">display name of the person to search for</param> /// <param name="addr">e-mail address of the person to search for</param> /// <returns>IMAPSearchQuery object suitable for passing into the search method</returns> public static IMAPSearchQuery QuickSearchBCC(string name, string addr) { IMAPSearchQuery query = new IMAPSearchQuery(); IMAPMailAddress a = new IMAPMailAddress(); a.Address = addr; a.DisplayName = name; query.BCC.Add(a); return(query); }
/// <summary> /// Helper method to quickly check whether a specific address exists within the specified list /// </summary> /// <param name="list">The source list to check</param> /// <param name="addr">The address to look for</param> /// <returns>True if the address was found, False if it wasnt</returns> private bool AddressListContains(List <IMAPMailAddress> list, IMAPMailAddress addr) { foreach (IMAPMailAddress a in list) { if (a.Address.Equals(addr.Address) || a.DisplayName.Equals(addr.DisplayName)) { return(true); } } return(false); }