InternetAddressList Class

A list of email addresses.

Definition

Namespace: MimeKit
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
[TypeConverterAttribute(typeof(InternetAddressListConverter))]
public class InternetAddressList : IList<InternetAddress>, 
	ICollection<InternetAddress>, IEnumerable<InternetAddress>, IEnumerable, 
	IEquatable<InternetAddressList>, IComparable<InternetAddressList>
Inheritance
Object    InternetAddressList
Implements
ICollectionInternetAddress, IEnumerableInternetAddress, IListInternetAddress, IEnumerable, IComparableInternetAddressList, IEquatableInternetAddressList

Remarks

An InternetAddressList may contain any number of addresses of any type defined by the original Internet Message specification.

There are effectively two (2) types of addresses: mailboxes and groups.

Mailbox addresses are what are most commonly known as email addresses and are represented by the MailboxAddress class.

Group addresses are themselves lists of addresses and are represented by the GroupAddress class. While rare, it is still important to handle these types of addresses. They typically only contain mailbox addresses, but may also contain other group addresses.

Example

C#
                    public static void AddRecipients (MimeMessage message, string recipients)
{
    // InternetAddressList.Parse() can parse a comma-separated list of addresses such as
    // what a user might type into the "To:" field of a mail client.
    var addresses = InternetAddressList.Parse (recipients);

    message.To.AddRange (addresses);
}
                  

Constructors

InternetAddressList Initialize a new instance of the InternetAddressList class.
InternetAddressList(IEnumerableInternetAddress) Initialize a new instance of the InternetAddressList class.

Properties

Count Get the number of addresses in the InternetAddressList.
IsReadOnly Get a value indicating whether the InternetAddressList is read only.
Item Get or set the InternetAddress at the specified index.
Mailboxes Recursively get all the mailboxes contained within the InternetAddressList.

Methods

Add Add an address to the InternetAddressList.
AddRange Add a collection of addresses to the InternetAddressList.
Clear Clear the address list.
CompareTo Compare two internet address lists.
Contains Check if the InternetAddressList contains the specified address.
CopyTo Copy all of the addresses in the InternetAddressList to the specified array.
Equals(InternetAddressList) Determine whether the specified InternetAddressList is equal to the current InternetAddressList.
Equals(Object) Determine whether the specified object is equal to the current object.
(Overrides ObjectEquals(Object))
Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetEnumerator Get an enumerator for the list of addresses.
GetHashCode Return the hash code for this instance.
(Overrides ObjectGetHashCode)
GetType Gets the Type of the current instance.
(Inherited from Object)
IndexOf Get the index of the specified address.
Insert Insert an address at the specified index.
MemberwiseClone Creates a shallow copy of the current Object.
(Inherited from Object)
Parse(Byte) Parse the given input buffer into a new InternetAddressList instance.
Parse(String) Parse the given text into a new InternetAddressList instance.
Parse(Byte, Int32) Parse the given input buffer into a new InternetAddressList instance.
Parse(ParserOptions, Byte) Parse the given input buffer into a new InternetAddressList instance.
Parse(ParserOptions, String) Parse the given text into a new InternetAddressList instance.
Parse(Byte, Int32, Int32) Parse the given input buffer into a new InternetAddressList instance.
Parse(ParserOptions, Byte, Int32) Parse the given input buffer into a new InternetAddressList instance.
Parse(ParserOptions, Byte, Int32, Int32) Parse the given input buffer into a new InternetAddressList instance.
Remove Remove an address from the InternetAddressList.
RemoveAt Remove the address at the specified index.
ToString Serialize an InternetAddressList to a string suitable for display.
(Overrides ObjectToString)
ToString(Boolean) Serialize an InternetAddressList to a string, optionally encoding the list of addresses for transport.
ToString(FormatOptions, Boolean) Serialize an InternetAddressList to a string, optionally encoding the list of addresses for transport.
TryParse(Byte, InternetAddressList) Try to parse the given input buffer into a new InternetAddressList instance.
TryParse(String, InternetAddressList) Try to parse the given text into a new InternetAddressList instance.
TryParse(Byte, Int32, InternetAddressList) Try to parse the given input buffer into a new InternetAddressList instance.
TryParse(ParserOptions, Byte, InternetAddressList) Try to parse the given input buffer into a new InternetAddressList instance.
TryParse(ParserOptions, String, InternetAddressList) Try to parse the given text into a new InternetAddressList instance.
TryParse(Byte, Int32, Int32, InternetAddressList) Try to parse the given input buffer into a new InternetAddressList instance.
TryParse(ParserOptions, Byte, Int32, InternetAddressList) Try to parse the given input buffer into a new InternetAddressList instance.
TryParse(ParserOptions, Byte, Int32, Int32, InternetAddressList) Try to parse the given input buffer into a new InternetAddressList instance.

Operators

(InternetAddressList to MailAddressCollection) Explicit cast to convert a InternetAddressList to a MailAddressCollection.
(MailAddressCollection to InternetAddressList) Explicit cast to convert a MailAddressCollection to a InternetAddressList.

See Also

Reference