java.lang.Object | +--javax.mail.MessageAll Implemented Interfaces:
Part
boolean | True if this message has been expunged. |
The containing folder, if this message is obtained from a folder | |
int | The number of this message within its folder, or zero if the message was not retrieved from a folder. |
The Session object for this Message |
Message() No-arg version of the constructor. |
Message(Folder folder, int msgnum) Constructor that takes a Folder and a message number. |
Constructor that takes a Session. |
void | Add these addresses to the existing "From" attribute |
void | addRecipient(Message.RecipientType type, Address address) Add this recipient address to the existing ones of the given type. |
void | addRecipients(Message.RecipientType type, Address addresses) Add these recipient addresses to the existing ones of the given type. |
Address[] | Get all the recipient addresses for the message. |
getFlags() Returns a Flags object containing the flags for this message. | |
Get the folder from which this message was obtained. | |
Address[] | getFrom() Returns the "From" attribute. |
int | Get the Message number for this Message. |
Date | Get the date this message was received. |
Address[] | getRecipients(Message.RecipientType type) Get all the recipient addresses of the given type. |
Address[] | Get the addresses to which replies should be directed. |
Date | Get the date this message was sent. |
String | Get the subject of this message. |
boolean | Checks whether this message is expunged. |
boolean | isSet(Flags.Flag flag) Check whether the flag specified in the flag argument is set in this message. |
boolean | match(SearchTerm term) Apply the specified Search criterion to this message. |
reply(boolean replyToAll) Get a new Message suitable for a reply to this message. | |
void | 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. |
void | setExpunged(boolean expunged) Sets the expunged flag for this Message. |
void | setFlag(Flags.Flag flag, boolean set) Set the specified flag on this message to the specified value. |
void | setFlags(Flags flag, boolean set) Set the specified flags on this message to the specified value. |
void | setFrom() Set the "From" attribute in this Message. |
void | Set the "From" attribute in this Message. |
void | setMessageNumber(int msgnum) Set the Message number for this Message. |
void | setRecipient(Message.RecipientType type, Address address) Set the recipient address. |
void | setRecipients(Message.RecipientType type, Address addresses) Set the recipient addresses. |
void | setReplyTo(Address addresses) Set the addresses to which replies should be directed. |
void | setSentDate(Date date) Set the sent date of this message. |
void | setSubject(String subject) Set the subject of this message. |
protected boolean expunged
protected Folder folder
protected int msgnum
protected Session session
protected Message()
protected Message(Folder folder, int msgnum)
protected Message(Session session)
public void addFrom(Address addresses)
IllegalWriteException
- if the underlying implementation does
not support modification of existing values
- if this message is obtained from a
READ_ONLY folder.public void addRecipient(Message.RecipientType type, Address address)
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuespublic void addRecipients(Message.RecipientType type, Address addresses)
IllegalWriteException
- if the underlying implementation
does not support modification of existing values
- if this message is obtained from
a READ_ONLY folder.public Address[] getAllRecipients()
public Flags getFlags()
setFlags()
to do that.
public Folder getFolder()
public Address[] getFrom()
public int getMessageNumber()
public Date getReceivedDate()
public Address[] getRecipients(Message.RecipientType type)
public Address[] getReplyTo()
public Date getSentDate()
public String getSubject()
public boolean isExpunged()
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.
Folder.expunge
public boolean isSet(Flags.Flag flag)
public boolean match(SearchTerm term)
public Message reply(boolean replyToAll)
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 void saveChanges()
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.
IllegalWriteException
- if the underlying implementation
does not support modification of existing values
- if this message is obtained from
a READ_ONLY folder.protected void setExpunged(boolean expunged)
public void setFlag(Flags.Flag flag, boolean set)
setFlags
method.
IllegalWriteException
- if the underlying implementation
does not support modification of existing values
- if this message is obtained from
a READ_ONLY folder.public void setFlags(Flags flag, boolean set)
IllegalWriteException
- if the underlying implementation
does not support modification of existing values
- if this message is obtained from
a READ_ONLY folder.public void setFrom()
IllegalWriteException
- if the underlying implementation does
not support modification of existing values
- if this message is obtained from a
READ_ONLY folder.public void setFrom(Address address)
IllegalWriteException
- if the underlying implementation does
not support modification of existing values
- if this message is obtained from a
READ_ONLY folder.protected void setMessageNumber(int msgnum)
public void setRecipient(Message.RecipientType type, Address address)
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuespublic void setRecipients(Message.RecipientType type, Address addresses)
IllegalWriteException
- if the underlying implementation
does not support modification of existing values
- if this message is obtained from
a READ_ONLY folder.public void setReplyTo(Address addresses)
public void setSentDate(Date date)
IllegalWriteException
- if the underlying implementation
does not support modification of existing values
- if this message is obtained from
a READ_ONLY folder.public void setSubject(String subject)
IllegalWriteException
- if the underlying implementation
does not support modification of existing values
- if this message is obtained from
a READ_ONLY folder.
Transport.send
method.