addFrom
public abstract void addFrom(Address[] addresses)
throws MessagingException
Add multiple addresses to the "From" header.
addresses
- the addresses to add
getAllRecipients
public Address[] getAllRecipients()
throws MessagingException
Get all recipients of this message.
The default implementation extracts the To, Cc, and Bcc recipients using
getRecipients(Message.RecipientType)
and then concatentates the results into a single array; it returns null if no headers are defined.
- an array containing all recipients
getFlags
public abstract Flags getFlags()
throws MessagingException
Return a copy the flags associated with this message.
- a copy of the flags for this message
getFolder
public Folder getFolder()
Return the folder containing this message. If this is a new or nested message
then this method returns null.
- the folder containing this message
getFrom
public abstract 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.
- 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
getMessageNumber
public int getMessageNumber()
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.
getReceivedDate
public abstract Date getReceivedDate()
throws MessagingException
Return the date this message was received.
- the date this message was received
getRecipients
public abstract Address[] getRecipients(Message.RecipientType type)
throws MessagingException
Get all recipients of the given type.
type
- the type of recipient to get
- a list of addresses; may be empty if the header is present but empty,
or null if the header is not present
getReplyTo
public Address[] getReplyTo()
throws MessagingException
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()
.
- a list of addresses to which replies should be directed
getSentDate
public abstract Date getSentDate()
throws MessagingException
Return the date that this message was sent.
- the date this message was sent
getSubject
public abstract String getSubject()
throws MessagingException
Get the subject for this message.
isExpunged
public boolean isExpunged()
Checks to see if this message has been expunged. If true, all methods other than
getMessageNumber()
are invalid.
- true if this method has been expunged
isSet
public boolean isSet(Flags.Flag flag)
throws MessagingException
Check whether the supplied flag is set.
The default implementation checks the flags returned by
getFlags()
.
flag
- the flags to check for
match
public boolean match(SearchTerm term)
throws MessagingException
Apply the specified search criteria to this message
term
- the search criteria
- true if this message matches the search criteria.
reply
public abstract 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.
replyToAll
- if true, indciates the message should be addressed to all recipients not just the sender
- a new message suitable as a reply to this message
saveChanges
public abstract 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.
setExpunged
protected void setExpunged(boolean expunged)
Set the expunged flag for this message.
expunged
- true if this message has been expunged
setFlags
public abstract 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.
flags
- the flags to modifyset
- the new value of those flags
setFrom
public abstract 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"
setFrom
public abstract void setFrom(Address address)
throws MessagingException
Set the "From" header to the supplied address.
address
- the address of the person who the message is from
setMessageNumber
protected void setMessageNumber(int number)
Set the message number for this Message.
This must be invoked by implementation classes when the message number changes.
number
- the new message number
setRecipient
public void setRecipient(Message.RecipientType type,
Address address)
throws MessagingException
Set the list of recipients for the specified type to a single address.
type
- the type of recipientaddress
- the new address
setRecipients
public abstract void setRecipients(Message.RecipientType type,
Address[] addresses)
throws MessagingException
Set the list of recipients for the specified type.
type
- the type of recipientaddresses
- the new addresses
setReplyTo
public void setReplyTo(Address[] addresses)
throws MessagingException
Set the addresses to which replies should be directed.
The default implementation throws a MethodNotSupportedException.
addresses
- to which replies should be directed
setSentDate
public abstract void setSentDate(Date sent)
throws MessagingException
Set the date this message was sent.
sent
- the date when this message was sent
setSubject
public abstract void setSubject(String subject)
throws MessagingException
Set the subject of this message