System
2.0.0.0
4.0.0.0
System.Object
The class is used by the and classes to store address information for e-mail messages.
A mail address is composed of a name, name and optionally, a . The can contain non-ASCII characters if you encode them.
The class supports the following mail address formats:
-
A simple address format of user@host. If a is not set, this is the mail address format generated.
-
A standard quoted display name format of "display name" <user@host>. If a is set, this is the format generated.
-
Angle brackets are added around the name, name for "display name" user@host if these are not included.
-
Quotes are added around the for display name <user@host>, if these are not included.
-
Unicode characters are supported in the . property.
-
A name with quotes. For example, "user name"@host.
-
Consecutive and trailing dots in user names. For example, user...name..@host.
-
Bracketed domain literals. For example, <user@[my domain]>.
-
Comments. For example, (comment)"display name"(comment)<(comment)user(comment)@(comment)domain(comment)>(comment). Comments are removed before transmission.
A comma is used to separate elements in a list of mail addresses. As a result, a comma should not be used in unquoted display names in a list. The following mail addresses would be allowed
"John, Doe" <user@host>, "Bob, Smith" <user2@host>
The following mail address would not be allowed:
John, Doe <user@host>, Bob, Smith <user2@host>
Quotes can be embedded in a quoted string, but they must be escaped. The following mail addresses would be allowed
"John \"Jr\" Doe" <user@host>
"\"John \\\"Jr\\\" Doe\" <user@host>"
The following mail address would not be allowed:
"John "Jr" Doe" <user@host>
When the username is note quoted, all text between the start of the string (or comma) and the address are considered part of the , including comments.
-- Example: (non comment) unquoted display (non comment) name (non comment) <user@host>
Although the class accepts a mail address as valid, other mail servers may not accept the mail address.
The class does not support the following mail address formats:
Mixed quoted and unquoted display names. For example, display "name" <user@host>
Groups, as defined in RFC 2822 Section 3.4 published by the IETF.
The obsolete user name formats of "user"."name"@host, user."name"@host or "user".name@host
Represents the address of an electronic mail sender or recipient.
Constructor
2.0.0.0
4.0.0.0
The parameter can contain a display name and the associated e-mail address if you enclose the address in angle brackets. For example:
"Tom Smith <tsmith@contoso.com>"
White space is permitted between the display name and the angle brackets.
The following table shows the property values for a object constructed using the preceding example address.
-
Property
Value
-
"Tom Smith"
-
"contoso.com"
-
"tsmith"
-
"tsmith@contoso.com"
Initializes a new instance of the class using the specified address.
A that contains an e-mail address.
Constructor
2.0.0.0
4.0.0.0
Leading and trailing white space in the display name is preserved.
If contains non-ASCII characters, the iso-8859-1 character set is used for the encoding. Encoding non-ASCII characters is discussed in RFC 1522, which is available at http://www.ietf.org.
If contains a display name, and is not null and is not equal to , overrides the value specified in .
Initializes a new instance of the class using the specified address and display name.
A that contains an e-mail address.
A that contains the display name associated with . This parameter can be null.
Constructor
2.0.0.0
4.0.0.0
System.MonoTODO("We don't do anything with displayNameEncoding")
Leading and trailing white space in the display name is preserved.
If contains a display name, and is not null and is not equal to , overrides the value specified in .
The method does not check if the parameter is valid. This method removes surrounding quotes not displayed by the property. Quotes will be added before transmission, except where or is specified in the parameter. The encoding specified in the parameter will be applied to the property before transmission or is specified in the parameter. is the default encoding if none is specified.
For more information on supported mail address formats, see .
Initializes a new instance of the class using the specified address, display name, and encoding.
A that contains an e-mail address.
A that contains the display name associated with .
The that defines the character set used for .
Property
2.0.0.0
4.0.0.0
System.String
To be added.
The value returned by this property does not include the information.
Gets the e-mail address specified when this instance was created.
Property
2.0.0.0
4.0.0.0
System.String
To be added.
Display names that contain non-ASCII characters are returned in human-readable form. Use the method to get the encoded form of the .
Some software programs that are used to read e-mail display the property value instead of, or in addition to, the e-mail address.
Gets the display name composed from the display name and address information specified when this instance was created.
Method
2.0.0.0
4.0.0.0
System.Boolean
To be added.
To be added.
Compares two mail addresses.
true if the two mail addresses are equal; otherwise, false.
Method
2.0.0.0
4.0.0.0
System.Int32
The method returns a hash code of the mail address. This value can be used as a key in hash tables.
Returns a hash value for a mail address.
An integer hash value.
Property
2.0.0.0
4.0.0.0
System.String
To be added.
In a typical e-mail address, the host string includes all information following the "@" sign. For example, in "tsmith@contoso.com", the host is "contoso.com".
Gets the host portion of the address specified when this instance was created.
Method
2.0.0.0
4.0.0.0
System.String
The string returned by this method is not necessarily identical to the string specified when the instance was created. If the property is not null and not equal to (""), returns a string composed using the following syntax:
<@>
If is null or is equal to , returns the value of the property.
Returns a string representation of this instance.
A that contains the contents of this .
Property
2.0.0.0
4.0.0.0
System.String
To be added.
In a typical e-mail address, the user string includes all information preceding the "@" sign. For example, in "tsmith@contoso.com", the user is "tsmith".
Gets the user information from the address specified when this instance was created.