public class EmailAddress
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static EmailAddress[] |
EMPTY_ARRAY |
Constructor and Description |
---|
EmailAddress(java.lang.String personalName,
java.lang.String email)
Creates new address by specifying email and personal name.
|
Modifier and Type | Method and Description |
---|---|
static javax.mail.internet.InternetAddress[] |
convert(EmailAddress[] addresses)
Convert from array of
EmailAddress to array of InternetAddress . |
java.lang.String |
getEmail()
Returns email address.
|
java.lang.String |
getPersonalName()
Returns personal name.
|
static EmailAddress[] |
of(javax.mail.Address... addresses)
Converts array of
Address to EmailAddress . |
static EmailAddress |
of(javax.mail.Address address)
Creates new email address from
InternetAddress . |
static EmailAddress |
of(javax.mail.internet.InternetAddress internetAddress)
Creates new email address from
InternetAddress . |
static EmailAddress[] |
of(java.lang.String... addresses)
Converts array of
String to EmailAddress . |
static EmailAddress |
of(java.lang.String address)
Creates new address by specifying one of the following:
"foo@bar.com" - only email address. |
static EmailAddress |
of(java.lang.String personalName,
java.lang.String email) |
javax.mail.internet.InternetAddress |
toInternetAddress()
Creates new
InternetAddress from current data. |
java.lang.String |
toString()
Returns string representation of this.
|
public static final EmailAddress[] EMPTY_ARRAY
public EmailAddress(java.lang.String personalName, java.lang.String email)
personalName
- personal name.email
- email address.public static EmailAddress of(java.lang.String personalName, java.lang.String email)
EmailAddress(String, String)
public static EmailAddress of(java.lang.String address)
"foo@bar.com" - only email address.
"Jenny Doe <foo@bar.com>" - first part of the string is personal name,
and the other part is email, surrounded with < and >.
address
- String
containing address to convert.public static EmailAddress of(javax.mail.internet.InternetAddress internetAddress)
InternetAddress
.internetAddress
- InternetAddress
to convertpublic static EmailAddress of(javax.mail.Address address)
InternetAddress
.address
- Address
to convert.public java.lang.String getEmail()
public java.lang.String getPersonalName()
null
.public java.lang.String toString()
toString
in class java.lang.Object
public javax.mail.internet.InternetAddress toInternetAddress() throws javax.mail.internet.AddressException
InternetAddress
from current data.InternetAddress
from current data.javax.mail.internet.AddressException
public static EmailAddress[] of(javax.mail.Address... addresses)
Address
to EmailAddress
.addresses
- array of Address
es to convert.EmailAddress
.public static EmailAddress[] of(java.lang.String... addresses)
String
to EmailAddress
.addresses
- array of String
s to convert.EmailAddress
.public static javax.mail.internet.InternetAddress[] convert(EmailAddress[] addresses) throws javax.mail.MessagingException
EmailAddress
to array of InternetAddress
.addresses
- EmailMessage
InternetAddress
. Returns empty array if addresses was null
.javax.mail.MessagingException
- if there are failuresCopyright © 2003-present Jodd Team