Message methods in java
This class models an email message. This is an abstract class. Subclasses provide actual implementations.
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.
Author: John Mani, Bill Shannon, Max Spivak See Also: Part
Nested Class Summary | |
---|---|
static class | Message.RecipientType This inner class defines the types of recipients allowed by the Message class. |
Field Summary | |
---|---|
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 int | msgnum The number of this message within its folder, or zero if the message was not retrieved from a folder. |
protected Session | session The Session object for this Message |
Fields inherited from interface javax.mail.Part |
---|
ATTACHMENT, INLINE |
Constructor Summary | |
---|---|
protected | Message () No-arg version of the constructor. |
protected | Message (Folder folder, int msgnum) Constructor that takes a Folder and a message number. |
protected | Message (Session session) Constructor that takes a Session. |
Method Summary | |
---|---|
abstract void | addFrom (Address[] addresses) 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. |
abstract void | addRecipients (Message.RecipientType type, Address[] addresses) Add these recipient addresses to the existing ones of the given type. |
Address[] | getAllRecipients () Get all the recipient addresses for the message. |
abstract Flags | getFlags () Returns a Flags object containing the flags for this message. |
Folder | getFolder () Get the folder from which this message was obtained. |
abstract Address[] | getFrom () Returns the «From» attribute. |
int | getMessageNumber () Get the Message number for this Message. |
abstract Date | getReceivedDate () Get the date this message was received. |
abstract Address[] | getRecipients (Message.RecipientType type) Get all the recipient addresses of the given type. |
Address[] | getReplyTo () Get the addresses to which replies should be directed. |
abstract Date | getSentDate () Get the date this message was sent. |
abstract String | getSubject () Get the subject of this message. |
boolean | isExpunged () 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. |
abstract Message | reply (boolean replyToAll) Get a new Message suitable for a reply to this message. |
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. |
protected 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. |
abstract void | setFlags (Flags flag, boolean set) Set the specified flags on this message to the specified value. |
abstract void | setFrom () Set the «From» attribute in this Message. |
abstract void | setFrom (Address address) Set the «From» attribute in this Message. |
protected void | setMessageNumber (int msgnum) Set the Message number for this Message. |
void | setRecipient (Message.RecipientType type, Address address) Set the recipient address. |
abstract void | setRecipients (Message.RecipientType type, Address[] addresses) Set the recipient addresses. |
void | setReplyTo (Address[] addresses) Set the addresses to which replies should be directed. |
abstract void | setSentDate (Date date) Set the sent date of this message. |
abstract void | setSubject (String subject) Set the subject of this message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.mail.Part |
---|
addHeader, getAllHeaders, getContent, getContentType, getDataHandler, getDescription, getDisposition, getFileName, getHeader, getInputStream, getLineCount, getMatchingHeaders, getNonMatchingHeaders, getSize, isMimeType, removeHeader, setContent, setContent, setDataHandler, setDescription, setDisposition, setFileName, setHeader, setText, writeTo |
msgnum
The number of this message within its folder, or zero if the message was not retrieved from a folder.
expunged
protected boolean expunged
Message methods in java
This class models an email message. This is an abstract class. Subclasses provide actual implementations.
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.
Author: John Mani, Bill Shannon, Max Spivak See Also: Part
Nested Class Summary | |
---|---|
static class | Message.RecipientType This inner class defines the types of recipients allowed by the Message class. |
Field Summary | |
---|---|
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 int | msgnum The number of this message within its folder, or zero if the message was not retrieved from a folder. |
protected Session | session The Session object for this Message |
Fields inherited from interface javax.mail.Part |
---|
ATTACHMENT, INLINE |
Constructor Summary | |
---|---|
protected | Message () No-arg version of the constructor. |
protected | Message (Folder folder, int msgnum) Constructor that takes a Folder and a message number. |
protected | Message (Session session) Constructor that takes a Session. |
Method Summary | |
---|---|
abstract void | addFrom (Address[] addresses) 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. |
abstract void | addRecipients (Message.RecipientType type, Address[] addresses) Add these recipient addresses to the existing ones of the given type. |
Address[] | getAllRecipients () Get all the recipient addresses for the message. |
abstract Flags | getFlags () Returns a Flags object containing the flags for this message. |
Folder | getFolder () Get the folder from which this message was obtained. |
abstract Address[] | getFrom () Returns the «From» attribute. |
int | getMessageNumber () Get the Message number for this Message. |
abstract java.util.Date | getReceivedDate () Get the date this message was received. |
abstract Address[] | getRecipients (Message.RecipientType type) Get all the recipient addresses of the given type. |
Address[] | getReplyTo () Get the addresses to which replies should be directed. |
abstract java.util.Date | getSentDate () Get the date this message was sent. |
abstract java.lang.String | getSubject () Get the subject of this message. |
boolean | isExpunged () 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. |
abstract Message | reply (boolean replyToAll) Get a new Message suitable for a reply to this message. |
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. |
protected 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. |
abstract void | setFlags (Flags flag, boolean set) Set the specified flags on this message to the specified value. |
abstract void | setFrom () Set the «From» attribute in this Message. |
abstract void | setFrom (Address address) Set the «From» attribute in this Message. |
protected void | setMessageNumber (int msgnum) Set the Message number for this Message. |
void | setRecipient (Message.RecipientType type, Address address) Set the recipient address. |
abstract void | setRecipients (Message.RecipientType type, Address[] addresses) Set the recipient addresses. |
void | setReplyTo (Address[] addresses) Set the addresses to which replies should be directed. |
abstract void | setSentDate (java.util.Date date) Set the sent date of this message. |
abstract void | setSubject (java.lang.String subject) Set the subject of this message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.mail.Part |
---|
addHeader, getAllHeaders, getContent, getContentType, getDataHandler, getDescription, getDisposition, getFileName, getHeader, getInputStream, getLineCount, getMatchingHeaders, getNonMatchingHeaders, getSize, isMimeType, removeHeader, setContent, setContent, setDataHandler, setDescription, setDisposition, setFileName, setHeader, setText, writeTo |
msgnum
The number of this message within its folder, or zero if the message was not retrieved from a folder.
expunged
protected boolean expunged