| java.lang.Object | ||
| ↳ | com.google.code.javax.mail.Address | |
| ↳ | com.google.code.javax.mail.internet.InternetAddress | |
This class represents an Internet email address using the syntax of RFC822. Typical address syntax is of the form "user@host.domain" or "Personal Name <user@host.domain>".
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| long | serialVersionUID | ||||||||||
| String | specialsNoDot | ||||||||||
| String | specialsNoDotNoAt | ||||||||||
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.code.javax.mail.Address
| |||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| address | |||||||||||
| encodedPersonal | The RFC 2047 encoded version of the personal name. | ||||||||||
| ignoreBogusGroupName | |||||||||||
| personal | The personal name. | ||||||||||
| rfc822phrase | |||||||||||
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Default constructor.
| |||||||||||
Constructor.
| |||||||||||
Parse the given string and create an InternetAddress.
| |||||||||||
Construct an InternetAddress given the address and personal name.
| |||||||||||
Construct an InternetAddress given the address and personal name.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Return a copy of this InternetAddress object.
| |||||||||||
The equality operator.
| |||||||||||
Get the email address.
| |||||||||||
Return the members of a group address.
| |||||||||||
Return an InternetAddress object representing the current user.
| |||||||||||
Get the personal name.
| |||||||||||
Return the type of this address.
| |||||||||||
Compute a hash code for the address.
| |||||||||||
Indicates whether this address is an RFC 822 group address.
| |||||||||||
Parse the given comma separated sequence of addresses into
InternetAddress objects.
| |||||||||||
Parse the given sequence of addresses into InternetAddress
objects.
| |||||||||||
Parse the given sequence of addresses into InternetAddress
objects.
| |||||||||||
Set the email address.
| |||||||||||
Set the personal name.
| |||||||||||
Set the personal name.
| |||||||||||
Convert the given array of InternetAddress objects into
a comma separated sequence of address strings.
| |||||||||||
Convert this address into a RFC 822 / RFC 2047 encoded address.
| |||||||||||
Convert the given array of InternetAddress objects into
a comma separated sequence of address strings.
| |||||||||||
Returns a properly formatted address (RFC 822 syntax) of
Unicode characters.
| |||||||||||
Validate that this address conforms to the syntax rules of
RFC 822.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.code.javax.mail.Address
| |||||||||||
From class
java.lang.Object
| |||||||||||
The RFC 2047 encoded version of the personal name.
This field and the personal field track each
other, so if a subclass sets one of these fields directly, it
should set the other to null, so that it is
suitably recomputed.
The personal name.
Default constructor.
Constructor.
Parse the given string and create an InternetAddress.
See the parse method for details of the parsing.
The address is parsed using "strict" parsing.
This constructor does not perform the additional
syntax checks that the
InternetAddress(String address, boolean strict)
constructor does when strict is true.
This constructor is equivalent to
InternetAddress(address, false).
| address | The address in RFC822 format |
|---|
| AddressException | if the parse failed |
|---|
Parse the given string and create an InternetAddress.
If strict is false, the detailed syntax of the
address isn't checked.
| address | The address in RFC822 format |
|---|---|
| strict | Enforce RFC822 syntax |
| AddressException | if the parse failed |
|---|
Construct an InternetAddress given the address and personal name. The address is assumed to be a syntactically valid RFC822 address.
| address | The address in RFC822 format |
|---|---|
| personal | The personal name |
| UnsupportedEncodingException |
|---|
Construct an InternetAddress given the address and personal name. The address is assumed to be a syntactically valid RFC822 address.
| address | The address in RFC822 format |
|---|---|
| personal | The personal name |
| charset | The MIME charset for the name |
| UnsupportedEncodingException |
|---|
Return a copy of this InternetAddress object.
The equality operator.
| a | Address object |
|---|
Get the email address.
Return the members of a group address. A group may have zero,
one, or more members. If this address is not a group, null
is returned. The strict parameter controls whether
the group list is parsed using strict RFC 822 rules or not.
The parsing is done using the parseHeader method.
| strict |
|---|
| AddressException | if the group list can't be parsed |
|---|
Return an InternetAddress object representing the current user.
The entire email address may be specified in the "mail.from"
property. If not set, the "mail.user" and "mail.host" properties
are tried. If those are not set, the "user.name" property and
InetAddress.getLocalHost method are tried.
Security exceptions that may occur while accessing this information
are ignored. If it is not possible to determine an email address,
null is returned.
| session | Session object used for property lookup |
|---|
Get the personal name. If the name is encoded as per RFC 2047, it is decoded and converted into Unicode. If the decoding or conversion fails, the raw data is returned as is.
Return the type of this address. The type of an InternetAddress is "rfc822".
Compute a hash code for the address.
Indicates whether this address is an RFC 822 group address. Note that a group address is different than the mailing list addresses supported by most mail servers. Group addresses are rarely used; see RFC 822 for details.
Parse the given comma separated sequence of addresses into InternetAddress objects. Addresses must follow RFC822 syntax.
| addresslist | Comma separated address strings |
|---|
| AddressException | if the parse failed |
|---|
Parse the given sequence of addresses into InternetAddress
objects. If strict is false, simple email addresses
separated by spaces are also allowed. If strict is
true, many (but not all) of the RFC822 syntax rules are enforced.
In particular, even if strict is true, addresses
composed of simple names (with no "@domain" part) are allowed.
Such "illegal" addresses are not uncommon in real messages.
Non-strict parsing is typically used when parsing a list of mail addresses entered by a human. Strict parsing is typically used when parsing address headers in mail messages.
| addresslist | Comma separated address strings |
|---|---|
| strict | Enforce RFC822 syntax |
| AddressException | if the parse failed |
|---|
Parse the given sequence of addresses into InternetAddress
objects. If strict is false, the full syntax rules for
individual addresses are not enforced. If strict is
true, many (but not all) of the RFC822 syntax rules are enforced.
To better support the range of "invalid" addresses seen in real
messages, this method enforces fewer syntax rules than the
parse method when the strict flag is false
and enforces more rules when the strict flag is true. If the
strict flag is false and the parse is successful in separating out an
email address or addresses, the syntax of the addresses themselves
is not checked.
| addresslist | Comma separated address strings |
|---|---|
| strict | Enforce RFC822 syntax |
| AddressException | if the parse failed |
|---|
Set the email address.
| address | Email address |
|---|
Set the personal name. If the name contains non US-ASCII characters, then the name will be encoded using the platform's default charset. If the name contains only US-ASCII characters, no encoding is done and the name is used as is.
| name | Personal name |
|---|
| UnsupportedEncodingException | if the charset encoding fails. |
|---|
Set the personal name. If the name contains non US-ASCII characters, then the name will be encoded using the specified charset as per RFC 2047. If the name contains only US-ASCII characters, no encoding is done and the name is used as is.
| name | Personal name |
|---|---|
| charset | MIME charset to be used to encode the name as per RFC 2047 |
| UnsupportedEncodingException | if the charset encoding fails. |
|---|
Convert the given array of InternetAddress objects into a comma separated sequence of address strings. The resulting string contains only US-ASCII characters, and hence is mail-safe.
The 'used' parameter specifies the number of character positions already taken up in the field into which the resulting address sequence string is to be inserted. It is used to determine the line-break positions in the resulting address sequence string.
| addresses | Array of InternetAddress objects |
|---|---|
| used | Number of character positions already used, in the field into which the address string is to be inserted. |
Convert this address into a RFC 822 / RFC 2047 encoded address. The resulting string contains only US-ASCII characters, and hence is mail-safe.
Convert the given array of InternetAddress objects into a comma separated sequence of address strings. The resulting string contains only US-ASCII characters, and hence is mail-safe.
| addresses | Array of InternetAddress objects |
|---|
Returns a properly formatted address (RFC 822 syntax) of Unicode characters.
Validate that this address conforms to the syntax rules of RFC 822. The current implementation checks many, but not all, syntax rules. Note that even though the syntax of the address may be correct, there's no guarantee that a mailbox of that name exists.
| AddressException | if the address isn't valid. |
|---|