Methods Summary |
---|
public abstract void | addFrom(javax.mail.Address[] addresses)Add these addresses to the existing "From" attribute
|
public void | addRecipient(javax.mail.Message$RecipientType type, javax.mail.Address address)Add this recipient address to the existing ones of the given type.
The default implementation uses the addRecipients method.
Address[] a = new Address[1];
a[0] = address;
addRecipients(type, a);
|
public abstract void | addRecipients(javax.mail.Message$RecipientType type, javax.mail.Address[] addresses)Add these recipient addresses to the existing ones of the given type.
|
public javax.mail.Address[] | getAllRecipients()Get all the recipient addresses for the message.
The default implementation extracts the TO, CC, and BCC
recipients using the getRecipients method.
This method returns null if none of the recipient
headers are present in this message. It may Return an empty array
if any recipient header is present, but contains no addresses.
Address[] to = getRecipients(RecipientType.TO);
Address[] cc = getRecipients(RecipientType.CC);
Address[] bcc = getRecipients(RecipientType.BCC);
if (cc == null && bcc == null)
return to; // a common case
int numRecip =
(to != null ? to.length : 0) +
(cc != null ? cc.length : 0) +
(bcc != null ? bcc.length : 0);
Address[] addresses = new Address[numRecip];
int pos = 0;
if (to != null) {
System.arraycopy(to, 0, addresses, pos, to.length);
pos += to.length;
}
if (cc != null) {
System.arraycopy(cc, 0, addresses, pos, cc.length);
pos += cc.length;
}
if (bcc != null) {
System.arraycopy(bcc, 0, addresses, pos, bcc.length);
pos += bcc.length;
}
return addresses;
|
public abstract javax.mail.Flags | getFlags()Returns a Flags object containing the flags for
this message.
Modifying any of the flags in this returned Flags object will
not affect the flags of this message. Use setFlags()
to do that.
|
public javax.mail.Folder | getFolder()Get the folder from which this message was obtained. If
this is a new message or nested message, this method returns
null.
return folder;
|
public abstract javax.mail.Address[] | getFrom()Returns the "From" attribute. The "From" attribute contains
the identity of the person(s) who wished this message to
be sent.
In certain implementations, this may be different
from the entity that actually sent the message.
This method returns null if this attribute
is not present in this message. Returns an empty array if
this attribute is present, but contains no addresses.
|
public int | getMessageNumber()Get the Message number for this Message.
A Message object's message number is the relative
position of this Message in its Folder. Note that the message
number for a particular Message can change during a session
if other messages in the Folder are deleted and expunged.
Valid message numbers start at 1. Messages that do not belong
to any folder (like newly composed or derived messages) have 0
as their message number.
return msgnum;
|
public abstract java.util.Date | getReceivedDate()Get the date this message was received.
|
public abstract javax.mail.Address[] | getRecipients(javax.mail.Message$RecipientType type)Get all the recipient addresses of the given type.
This method returns null if no recipients of
the given type are present in this message. It may return an
empty array if the header is present, but contains no addresses.
|
public javax.mail.Address[] | getReplyTo()Get the addresses to which replies should be directed.
This will usually be the sender of the message, but
some messages may direct replies to a different address.
The default implementation simply calls the getFrom
method.
This method returns null if the corresponding
header is not present. Returns an empty array if the header
is present, but contains no addresses.
return getFrom();
|
public abstract java.util.Date | getSentDate()Get the date this message was sent.
|
public abstract java.lang.String | getSubject()Get the subject of this message.
|
public boolean | isExpunged()Checks whether this message is expunged. All other methods except
getMessageNumber() are invalid on an expunged
Message object.
Messages that are expunged due to an explict expunge()
request on the containing Folder are removed from the Folder
immediately. Messages that are externally expunged by another source
are marked "expunged" and return true for the isExpunged() method,
but they are not removed from the Folder until an explicit
expunge() is done on the Folder.
See the description of expunge() for more details on
expunge handling.
return expunged;
|
public boolean | isSet(javax.mail.Flags$Flag flag)Check whether the flag specified in the flag
argument is set in this message.
The default implementation uses getFlags .
return getFlags().contains(flag);
|
public boolean | match(javax.mail.search.SearchTerm term)Apply the specified Search criterion to this message.
return term.match(this);
|
public abstract Message | reply(boolean replyToAll)Get a new Message suitable for a reply to this message.
The new Message will have its attributes and headers
set up appropriately. Note that this new message object
will be empty, that is, it will not have a "content".
These will have to be suitably filled in by the client.
If replyToAll is set, the new Message will be addressed
to all recipients of this message. Otherwise, the reply will be
addressed to only the sender of this message (using the value
of the getReplyTo method).
The "Subject" field is filled in with the original subject
prefixed with "Re:" (unless it already starts with "Re:").
The reply message will use the same session as this message.
|
public abstract void | saveChanges()Save any changes made to this message into the message-store
when the containing folder is closed, if the message is contained
in a folder. (Some implementations may save the changes
immediately.) Update any header fields to be consistent with the
changed message contents. If any part of a message's headers or
contents are changed, saveChanges must be called to ensure that
those changes are permanent. If saveChanges is not called, any
such modifications may or may not be saved, depending on the
message store and folder implementation.
Messages obtained from folders opened READ_ONLY should not be
modified and saveChanges should not be called on such messages.
|
protected void | setExpunged(boolean expunged)Sets the expunged flag for this Message. This method is to
be used only by the implementation classes.
this.expunged = expunged;
|
public void | setFlag(javax.mail.Flags$Flag flag, boolean set)Set the specified flag on this message to the specified value.
This will result in a MessageChangedEvent being
delivered to any MessageChangedListener registered on this
Message's containing folder.
The default implementation uses the setFlags method.
Flags f = new Flags(flag);
setFlags(f, set);
|
public abstract void | setFlags(javax.mail.Flags flag, boolean set)Set the specified flags on this message to the specified value.
Note that any flags in this message that are not specified in
the given Flags object are unaffected.
This will result in a MessageChangedEvent being
delivered to any MessageChangedListener registered on this
Message's containing folder.
|
public abstract void | setFrom()Set the "From" attribute in this Message. The value of this
attribute is obtained from the property "mail.user". If this
property is absent, the system property "user.name" is used.
|
public abstract void | setFrom(javax.mail.Address address)Set the "From" attribute in this Message.
|
protected void | setMessageNumber(int msgnum)Set the Message number for this Message. This method is
invoked only by the implementation classes.
this.msgnum = msgnum;
|
public void | setRecipient(javax.mail.Message$RecipientType type, javax.mail.Address address)Set the recipient address. All addresses of the specified
type are replaced by the address parameter.
The default implementation uses the setRecipients method.
Address[] a = new Address[1];
a[0] = address;
setRecipients(type, a);
|
public abstract void | setRecipients(javax.mail.Message$RecipientType type, javax.mail.Address[] addresses)Set the recipient addresses. All addresses of the specified
type are replaced by the addresses parameter.
|
public void | setReplyTo(javax.mail.Address[] addresses)Set the addresses to which replies should be directed.
(Normally only a single address will be specified.)
Not all message types allow this to be specified separately
from the sender of the message.
The default implementation provided here just throws the
MethodNotSupportedException.
throw new MethodNotSupportedException("setReplyTo not supported");
|
public abstract void | setSentDate(java.util.Date date)Set the sent date of this message.
|
public abstract void | setSubject(java.lang.String subject)Set the subject of this message.
|