javax.mail
public abstract class Message extends Object implements Part
Nested Class Summary | |
---|---|
static class | Message.RecipientType
Enumeration of types of recipients allowed by the Message class. |
Field Summary | |
---|---|
protected boolean | expunged
True if this message has been expunged from the Store. |
protected Folder | folder
The Folder that contains this message, or null if it was not obtained from a folder. |
protected int | msgnum
The index of a message withing its folder, or zero if the message was not retrieved from a folder. |
protected Session | session
The Session associated with this message. |
Constructor Summary | |
---|---|
protected | Message()
Default constructor. |
protected | Message(Folder folder, int msgnum)
Constructor initializing folder and message msgnum; intended to be used by implementations of Folder.
|
protected | Message(Session session)
Constructor initializing the session; intended to by used by client created instances.
|
Method Summary | |
---|---|
abstract void | addFrom(Address[] addresses)
Add multiple addresses to the "From" header.
|
void | addRecipient(Message.RecipientType type, Address address)
Add a recipent of a specified type.
|
abstract void | addRecipients(Message.RecipientType type, Address[] addresses)
Add recipents of a specified type.
|
Address[] | getAllRecipients()
Get all recipients of this message.
|
abstract Flags | getFlags()
Return a copy the flags associated with this message.
|
Folder | getFolder()
Return the folder containing this message. |
abstract Address[] | getFrom()
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.
|
int | getMessageNumber()
Return the message number for this Message.
|
abstract Date | getReceivedDate()
Return the date this message was received.
|
abstract Address[] | getRecipients(Message.RecipientType type)
Get all recipients of the given type.
|
Address[] | getReplyTo()
Get the addresses to which replies should be directed.
|
abstract Date | getSentDate()
Return the date that this message was sent.
|
abstract String | getSubject()
Get the subject for this message.
|
boolean | isExpunged()
Checks to see if this message has been expunged. |
boolean | isSet(Flags.Flag flag)
Check whether the supplied flag is set.
|
boolean | match(SearchTerm term)
Apply the specified search criteria to this message
|
abstract Message | reply(boolean replyToAll)
Create a new message suitable as a reply to this message with all headers set
up appropriately. |
abstract void | saveChanges()
To ensure changes are saved to the store, this message should be invoked
before its containing folder is closed. |
protected void | setExpunged(boolean expunged)
Set the expunged flag for this message.
|
void | setFlag(Flags.Flag flag, boolean set)
Set a flag to the supplied value.
|
abstract void | setFlags(Flags flags, boolean set)
Set the flags specified to the supplied value; flags not included in the
supplied Flags parameter are not affected.
|
abstract void | setFrom()
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 void | setFrom(Address address)
Set the "From" header to the supplied address.
|
protected void | setMessageNumber(int number)
Set the message number for this Message.
|
void | setRecipient(Message.RecipientType type, Address address)
Set the list of recipients for the specified type to a single address.
|
abstract void | setRecipients(Message.RecipientType type, Address[] addresses)
Set the list of recipients for the specified type.
|
void | setReplyTo(Address[] addresses)
Set the addresses to which replies should be directed.
|
abstract void | setSentDate(Date sent)
Set the date this message was sent.
|
abstract void | setSubject(String subject)
Set the subject of this message
|
Parameters: folder the folder that contains the message msgnum the message index within the folder
Parameters: session the session associated with this message
Parameters: addresses the addresses to add
Throws: MessagingException if there was a problem accessing the store
Parameters: type the type of recipient address the address to add
Throws: MessagingException if there was a problem accessing the store
Parameters: type the type of recipient addresses the addresses to add
Throws: MessagingException if there was a problem accessing the store
Returns: an array containing all recipients
Throws: MessagingException if there was a problem accessing the store
Returns: a copy of the flags for this message
Throws: MessagingException if there was a problem accessing the store
Returns: the folder containing this message
Returns: a list of addresses this message is from; may be empty if the header is present but empty, or null if the header is not present
Throws: MessagingException if there was a problem accessing the store
Returns: the message number
Returns: the date this message was received
Throws: MessagingException if there was a problem accessing the store
Parameters: type the type of recipient to get
Returns: a list of addresses; may be empty if the header is present but empty, or null if the header is not present
Throws: MessagingException if there was a problem accessing the store
See Also: RecipientType
Returns: a list of addresses to which replies should be directed
Throws: MessagingException if there was a problem accessing the store
Returns: the date this message was sent
Throws: MessagingException if there was a problem accessing the store
Returns: the subject
Throws: MessagingException if there was a problem accessing the store
Returns: true if this method has been expunged
Parameters: flag the flags to check for
Returns: true if the flags is set
Throws: MessagingException if there was a problem accessing the store
Parameters: term the search criteria
Returns: true if this message matches the search criteria.
Throws: MessagingException if there was a problem accessing the store
Parameters: replyToAll if true, indciates the message should be addressed to all recipients not just the sender
Returns: a new message suitable as a reply to this message
Throws: MessagingException if there was a problem accessing the store
Throws: MessagingException if there was a problem accessing the store
Parameters: expunged true if this message has been expunged
Parameters: flag the flag to set set the value for that flag
Throws: MessagingException if there was a problem accessing the store
Parameters: flags the flags to modify set the new value of those flags
Throws: MessagingException if there was a problem accessing the store
Throws: MessagingException if there was a problem accessing the store
Parameters: address the address of the person who the message is from
Throws: MessagingException if there was a problem accessing the store
Parameters: number the new message number
Parameters: type the type of recipient address the new address
Throws: MessagingException if there was a problem accessing the store
Parameters: type the type of recipient addresses the new addresses
Throws: MessagingException if there was a problem accessing the store
Parameters: addresses to which replies should be directed
Throws: MessagingException if there was a problem accessing the store
Parameters: sent the date when this message was sent
Throws: MessagingException if there was a problem accessing the store
Parameters: subject the subject
Throws: MessagingException if there was a problem accessing the store