java.lang.Objectjavax.mail.Message
All Implemented Interfaces:
Part
Direct Known Subclasses:
SimpleTextMessage, MimeMessage
Message implements the Part interface. Message contains a set of attributes and a "content". Messages within a folder also have a set of flags that describe its state within the folder.
Message defines some new attributes in addition to those defined
in the Part interface. These attributes specify meta-data
for the message - i.e., addressing and descriptive information about
the message.
Message objects are obtained either from a Folder or by constructing a new Message object of the appropriate subclass. Messages that have been received are normally retrieved from a folder named "INBOX".
A Message object obtained from a folder is just a lightweight
reference to the actual message. The Message is 'lazily' filled
up (on demand) when each item is requested from the message. Note
that certain folder implementations may return Message objects that
are pre-filled with certain user-specified items.
To send a message, an appropriate subclass of Message (e.g.,
MimeMessage) is instantiated, the attributes and content are
filled in, and the message is sent using the Transport.send
method.
John - ManiBill - ShannonMax - Spivak| Nested Class Summary: | ||
|---|---|---|
| public static class | Message.RecipientType | This inner class defines the types of recipients allowed by
the Message class. The currently defined types are TO,
CC and BCC.
Note that this class only has a protected constructor, thereby
restricting new Recipient types to either this class or subclasses.
This effectively implements an enumeration of the allowed Recipient
types.
The following code sample shows how to use this class to obtain
the "TO" recipients from a message.
Message msg = folder.getMessages(1); Address[] a = m.getRecipients(Message.RecipientType.TO);
|
| Field Summary | ||
|---|---|---|
| protected int | msgnum | The number of this message within its folder, or zero if the message was not retrieved from a folder. |
| protected boolean | expunged | True if this message has been expunged. |
| protected Folder | folder | The containing folder, if this message is obtained from a folder |
| protected Session | session | The Session object for this Message |
| Constructor: |
|---|
|
|
|
| Method from javax.mail.Message Summary: |
|---|
| addFrom, addRecipient, addRecipients, getAllRecipients, getFlags, getFolder, getFrom, getMessageNumber, getReceivedDate, getRecipients, getReplyTo, getSentDate, getSubject, isExpunged, isSet, match, reply, saveChanges, setExpunged, setFlag, setFlags, setFrom, setFrom, setMessageNumber, setRecipient, setRecipients, setReplyTo, setSentDate, setSubject |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from javax.mail.Message Detail: |
|---|
|
The default implementation uses the |
|
getRecipients method.
This method returns |
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 |
|
In certain implementations, this may be different from the entity that actually sent the message.
This method returns |
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. |
|
This method returns |
The default implementation simply calls the
This method returns |
|
|
getMessageNumber() are invalid on an expunged
Message object.
Messages that are expunged due to an explict
See the description of |
flag
argument is set in this message.
The default implementation uses |
|
If 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. |
Messages obtained from folders opened READ_ONLY should not be modified and saveChanges should not be called on such messages. |
|
MessageChangedEvent being
delivered to any MessageChangedListener registered on this
Message's containing folder.
The default implementation uses the |
Flags object are unaffected.
This will result in a |
|
|
|
The default implementation uses the |
|
The default implementation provided here just throws the MethodNotSupportedException. |
|
|