| Method from javax.mail.Message Detail: |
abstract public void addFrom(Address[] addresses) throws MessagingException
Add multiple addresses to the "From" header. |
public void addRecipient(Message.RecipientType type,
Address address) throws MessagingException {
addRecipients(type, new Address[]{address});
}
Add a recipent of a specified type. |
abstract public void addRecipients(Message.RecipientType type,
Address[] addresses) throws MessagingException
Add recipents of a specified type. |
public Address[] getAllRecipients() throws MessagingException {
Address[] to = getRecipients(RecipientType.TO);
Address[] cc = getRecipients(RecipientType.CC);
Address[] bcc = getRecipients(RecipientType.BCC);
if (to == null && cc == null && bcc == null) {
return null;
}
int length = (to != null ? to.length : 0) + (cc != null ? cc.length : 0) + (bcc != null ? bcc.length : 0);
Address[] result = new Address[length];
int j = 0;
if (to != null) {
for (int i = 0; i < to.length; i++) {
result[j++] = to[i];
}
}
if (cc != null) {
for (int i = 0; i < cc.length; i++) {
result[j++] = cc[i];
}
}
if (bcc != null) {
for (int i = 0; i < bcc.length; i++) {
result[j++] = bcc[i];
}
}
return result;
}
Get all recipients of this message.
The default implementation extracts the To, Cc, and Bcc recipients using #getRecipients(javax.mail.Message.RecipientType)
and then concatentates the results into a single array; it returns null if no headers are defined. |
abstract public Flags getFlags() throws MessagingException
Return a copy the flags associated with this message. |
public Folder getFolder() {
return folder;
}
Return the folder containing this message. If this is a new or nested message
then this method returns null. |
abstract public Address[] getFrom() throws MessagingException
Return the "From" header indicating the identity of the person who the message is from;
in some circumstances this may be different to the actual sender. |
public int getMessageNumber() {
return msgnum;
}
Return the message number for this Message.
This number refers to the relative position of this message in a Folder; the message
number for any given message can change during a seesion if the Folder is expunged.
Message numbers for messages in a folder start at one; the value zero indicates that
this message does not belong to a folder. |
abstract public Date getReceivedDate() throws MessagingException
Return the date this message was received. |
abstract public Address[] getRecipients(Message.RecipientType type) throws MessagingException
Get all recipients of the given type. |
public Address[] getReplyTo() throws MessagingException {
return getFrom();
}
Get the addresses to which replies should be directed.
As the most common behavior is to return to sender, the default implementation
simply calls #getFrom() . |
abstract public Date getSentDate() throws MessagingException
Return the date that this message was sent. |
abstract public String getSubject() throws MessagingException
Get the subject for this message. |
public boolean isExpunged() {
return expunged;
}
Checks to see if this message has been expunged. If true, all methods other than
#getMessageNumber() are invalid. |
public boolean isSet(Flags.Flag flag) throws MessagingException {
return getFlags().contains(flag);
}
Check whether the supplied flag is set.
The default implementation checks the flags returned by #getFlags() . |
public boolean match(SearchTerm term) throws MessagingException {
return term.match(this);
}
Apply the specified search criteria to this message |
abstract public Message reply(boolean replyToAll) throws MessagingException
Create a new message suitable as a reply to this message with all headers set
up appropriately. The message body will be empty.
if replyToAll is set then the new message will be addressed to all recipients
of this message; otherwise the reply will be addressed only to the sender as
returned by #getReplyTo() .
The subject field will be initialized with the subject field from the orginal
message; the text "Re:" will be prepended unless it is already present. |
abstract public void saveChanges() throws MessagingException
To ensure changes are saved to the store, this message should be invoked
before its containing folder is closed. Implementations may save modifications
immediately but are free to defer such updates to they may be sent to the server
in one batch; if saveChanges is not called then such changes may not be made
permanent. |
protected void setExpunged(boolean expunged) {
this.expunged = expunged;
}
Set the expunged flag for this message. |
public void setFlag(Flags.Flag flag,
boolean set) throws MessagingException {
setFlags(new Flags(flag), set);
}
|
abstract public void setFlags(Flags flags,
boolean set) throws MessagingException
Set the flags specified to the supplied value; flags not included in the
supplied Flags parameter are not affected. |
abstract public void setFrom() throws MessagingException
Set the "From" header for this message to the value of the "mail.user" property,
of if that property is not set, to the value of the system property "user.name" |
abstract public void setFrom(Address address) throws MessagingException
Set the "From" header to the supplied address. |
protected void setMessageNumber(int number) {
msgnum = number;
}
Set the message number for this Message.
This must be invoked by implementation classes when the message number changes. |
public void setRecipient(Message.RecipientType type,
Address address) throws MessagingException {
setRecipients(type, new Address[]{address});
}
Set the list of recipients for the specified type to a single address. |
abstract public void setRecipients(Message.RecipientType type,
Address[] addresses) throws MessagingException
Set the list of recipients for the specified type. |
public void setReplyTo(Address[] addresses) throws MessagingException {
throw new MethodNotSupportedException("setReplyTo not supported");
}
Set the addresses to which replies should be directed.
The default implementation throws a MethodNotSupportedException. |
abstract public void setSentDate(Date sent) throws MessagingException
Set the date this message was sent. |
abstract public void setSubject(String subject) throws MessagingException
Set the subject of this message |