Class IMAPMessage
- java.lang.Object
-
- javax.mail.Message
-
- javax.mail.internet.MimeMessage
-
- com.sun.mail.imap.IMAPMessage
-
- All Implemented Interfaces:
ReadableMime,MimePart,Part
- Direct Known Subclasses:
IMAPNestedMessage
public class IMAPMessage extends MimeMessage implements ReadableMime
This class implements an IMAPMessage object.An IMAPMessage object starts out as a light-weight object. It gets filled-in incrementally when a request is made for some item. Or when a prefetch is done using the FetchProfile.
An IMAPMessage has a messageNumber and a sequenceNumber. The messageNumber is its index into its containing folder's messageCache. The sequenceNumber is its IMAP sequence-number.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIMAPMessage.FetchProfileConditionThis class implements the test to be done on each message in the folder.-
Nested classes/interfaces inherited from class javax.mail.internet.MimeMessage
MimeMessage.RecipientType
-
-
Field Summary
-
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFrom(Address[] addresses)Add the specified addresses to the existing "From" field.voidaddHeader(java.lang.String name, java.lang.String value)Add this value to the existing values for this header_name.voidaddHeaderLine(java.lang.String line)Add a raw RFC 822 header-line.voidaddRecipients(Message.RecipientType type, Address[] addresses)Add the given addresses to the specified recipient type.java.util.Enumeration<java.lang.String>getAllHeaderLines()Get all header-lines.java.util.Enumeration<Header>getAllHeaders()Get all headers.java.lang.StringgetContentID()Get the Content-ID.java.lang.String[]getContentLanguage()Get the content language.java.lang.StringgetContentMD5()Get the Content-MD5.java.lang.StringgetContentType()Get the Content-Type.javax.activation.DataHandlergetDataHandler()Get the DataHandler object for this message.java.lang.StringgetDescription()Get the decoded Content-Description.java.lang.StringgetDisposition()Get the Content-Disposition.java.lang.StringgetEncoding()Get the Content-Transfer-Encoding.java.lang.StringgetFileName()Get the "filename" Disposition parameter.FlagsgetFlags()Get the Flags for this message.Address[]getFrom()Get the "From" attribute.java.lang.String[]getHeader(java.lang.String name)Get the named header.java.lang.StringgetHeader(java.lang.String name, java.lang.String delimiter)Get the named header.java.lang.StringgetInReplyTo()Get the In-Reply-To header.java.lang.ObjectgetItem(FetchItem fitem)Return the data associated with the FetchItem.intgetLineCount()Get the total number of lines.java.util.Enumeration<java.lang.String>getMatchingHeaderLines(java.lang.String[] names)Get all matching header-lines.java.util.Enumeration<Header>getMatchingHeaders(java.lang.String[] names)Get matching headers.java.lang.StringgetMessageID()Get the Message-ID.java.io.InputStreamgetMimeStream()Return the MIME format stream corresponding to this message.longgetModSeq()Return the modification sequence number (MODSEQ) for this message.java.util.Enumeration<java.lang.String>getNonMatchingHeaderLines(java.lang.String[] names)Get all non-matching headerlines.java.util.Enumeration<Header>getNonMatchingHeaders(java.lang.String[] names)Get non-matching headers.booleangetPeek()Get whether or not to use the PEEK variant of FETCH when fetching message content.java.util.DategetReceivedDate()Get the received date (INTERNALDATE).Address[]getRecipients(Message.RecipientType type)Get the desired Recipient type.Address[]getReplyTo()Get the ReplyTo addresses.AddressgetSender()Get the "Sender" attribute.java.util.DategetSentDate()Get the SentDate.intgetSize()Get the message size.longgetSizeLong()Get the message size as a long.java.lang.StringgetSubject()Get the decoded subject.voidinvalidateHeaders()Invalidate cached header and envelope information for this message.booleanisSet(Flags.Flag flag)Test if the given Flags are set in this message.voidremoveHeader(java.lang.String name)Remove all headers with this name.voidsetContentID(java.lang.String cid)Set the "Content-ID" header field of this Message.voidsetContentLanguage(java.lang.String[] languages)Set the "Content-Language" header of this MimePart.voidsetContentMD5(java.lang.String md5)Set the "Content-MD5" header field of this Message.voidsetDataHandler(javax.activation.DataHandler content)This method provides the mechanism to set this part's content.voidsetDescription(java.lang.String description, java.lang.String charset)Set the "Content-Description" header field for this Message.voidsetDisposition(java.lang.String disposition)Set the disposition in the "Content-Disposition" header field of this body part.voidsetFileName(java.lang.String filename)Set the filename associated with this part, if possible.voidsetFlags(Flags flag, boolean set)Set/Unset the given flags in this message.voidsetFrom(Address address)Set the RFC 822 "From" header field.voidsetHeader(java.lang.String name, java.lang.String value)Set the value for this header_name.voidsetPeek(boolean peek)Set whether or not to use the PEEK variant of FETCH when fetching message content.voidsetRecipients(Message.RecipientType type, Address[] addresses)Set the specified recipient type to the given addresses.voidsetReplyTo(Address[] addresses)Set the RFC 822 "Reply-To" header field.voidsetSender(Address address)Set the RFC 822 "Sender" header field.voidsetSentDate(java.util.Date d)Set the RFC 822 "Date" header field.voidsetSubject(java.lang.String subject, java.lang.String charset)Set the "Subject" header field.voidwriteTo(java.io.OutputStream os)Write out the bytes into the given OutputStream.-
Methods inherited from class javax.mail.internet.MimeMessage
addRecipients, getAllRecipients, getContent, getInputStream, getRawInputStream, isMimeType, reply, reply, saveChanges, setContent, setContent, setDescription, setFrom, setFrom, setRecipients, setSubject, setText, setText, setText, writeTo
-
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, getSession, isExpunged, match, setFlag, setRecipient
-
-
-
-
Method Detail
-
getModSeq
public long getModSeq() throws MessagingExceptionReturn the modification sequence number (MODSEQ) for this message. Returns -1 if not known.- Returns:
- the modification sequence number
- Throws:
MessagingException- for failures- Since:
- JavaMail 1.5.1
- See Also:
- "RFC 4551"
-
getFrom
public Address[] getFrom() throws MessagingException
Get the "From" attribute.- Overrides:
getFromin classMimeMessage- Returns:
- Address object
- Throws:
MessagingException- for failures- See Also:
MimeMessage.headers
-
setFrom
public void setFrom(Address address) throws MessagingException
Description copied from class:MimeMessageSet the RFC 822 "From" header field. Any existing values are replaced with the given address. If address isnull, this header is removed.- Overrides:
setFromin classMimeMessage- Parameters:
address- the sender of this message- Throws:
IllegalWriteException- if the underlying implementation does not support modification of existing valuesMessagingException- for other failures
-
addFrom
public void addFrom(Address[] addresses) throws MessagingException
Description copied from class:MimeMessageAdd the specified addresses to the existing "From" field. If the "From" field does not already exist, it is created.- Overrides:
addFromin classMimeMessage- Parameters:
addresses- the senders of this message- Throws:
IllegalWriteException- if the underlying implementation does not support modification of existing valuesMessagingException- for other failures
-
getSender
public Address getSender() throws MessagingException
Get the "Sender" attribute.- Overrides:
getSenderin classMimeMessage- Returns:
- Address object
- Throws:
MessagingException- for failures- See Also:
MimeMessage.headers
-
setSender
public void setSender(Address address) throws MessagingException
Description copied from class:MimeMessageSet the RFC 822 "Sender" header field. Any existing values are replaced with the given address. If address isnull, this header is removed.- Overrides:
setSenderin classMimeMessage- Parameters:
address- the sender of this message- Throws:
IllegalWriteException- if the underlying implementation does not support modification of existing valuesMessagingException- for other failures
-
getRecipients
public Address[] getRecipients(Message.RecipientType type) throws MessagingException
Get the desired Recipient type.- Overrides:
getRecipientsin classMimeMessage- Parameters:
type- Type of recepient- Returns:
- array of Address objects
- Throws:
MessagingException- if header could not be retrievedAddressException- if the header is misformatted- See Also:
MimeMessage.headers,Message.RecipientType.TO,Message.RecipientType.CC,Message.RecipientType.BCC,MimeMessage.RecipientType.NEWSGROUPS
-
setRecipients
public void setRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException
Description copied from class:MimeMessageSet the specified recipient type to the given addresses. If the address parameter isnull, the corresponding recipient field is removed.- Overrides:
setRecipientsin classMimeMessage- Parameters:
type- Recipient typeaddresses- Addresses- Throws:
IllegalWriteException- if the underlying implementation does not support modification of existing valuesMessagingException- for other failures- See Also:
MimeMessage.getRecipients(javax.mail.Message.RecipientType)
-
addRecipients
public void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException
Description copied from class:MimeMessageAdd the given addresses to the specified recipient type.- Overrides:
addRecipientsin classMimeMessage- Parameters:
type- Recipient typeaddresses- Addresses- Throws:
IllegalWriteException- if the underlying implementation does not support modification of existing valuesMessagingException- for other failures
-
getReplyTo
public Address[] getReplyTo() throws MessagingException
Get the ReplyTo addresses.- Overrides:
getReplyToin classMimeMessage- Returns:
- addresses to which replies should be directed
- Throws:
MessagingException- for failures- See Also:
MimeMessage.headers
-
setReplyTo
public void setReplyTo(Address[] addresses) throws MessagingException
Description copied from class:MimeMessageSet the RFC 822 "Reply-To" header field. If the address parameter isnull, this header is removed.- Overrides:
setReplyToin classMimeMessage- Parameters:
addresses- addresses to which replies should be directed- Throws:
IllegalWriteException- if the underlying implementation does not support modification of existing valuesMessagingException- for other failures
-
getSubject
public java.lang.String getSubject() throws MessagingExceptionGet the decoded subject.- Overrides:
getSubjectin classMimeMessage- Returns:
- Subject
- Throws:
MessagingException- for failures- See Also:
MimeMessage.headers
-
setSubject
public void setSubject(java.lang.String subject, java.lang.String charset) throws MessagingExceptionDescription copied from class:MimeMessageSet the "Subject" header field. If the subject contains non US-ASCII characters, it will be encoded using the specified charset. If the subject contains only US-ASCII characters, no encoding is done and it is used as-is. If the subject is null, the existing "Subject" header field is removed.The application must ensure that the subject does not contain any line breaks.
Note that if the charset encoding process fails, a MessagingException is thrown, and an UnsupportedEncodingException is included in the chain of nested exceptions within the MessagingException.
- Overrides:
setSubjectin classMimeMessage- Parameters:
subject- The subjectcharset- The charset- Throws:
IllegalWriteException- if the underlying implementation does not support modification of existing valuesMessagingException- for other failures
-
getSentDate
public java.util.Date getSentDate() throws MessagingExceptionGet the SentDate.- Overrides:
getSentDatein classMimeMessage- Returns:
- The sent Date
- Throws:
MessagingException- for failures
-
setSentDate
public void setSentDate(java.util.Date d) throws MessagingExceptionDescription copied from class:MimeMessageSet the RFC 822 "Date" header field. This is the date on which the creator of the message indicates that the message is complete and ready for delivery. If the date parameter isnull, the existing "Date" field is removed.- Overrides:
setSentDatein classMimeMessage- Parameters:
d- the sent date of this message- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures
-
getReceivedDate
public java.util.Date getReceivedDate() throws MessagingExceptionGet the received date (INTERNALDATE).- Overrides:
getReceivedDatein classMimeMessage- Returns:
- the date this message was received
- Throws:
MessagingException- for failures
-
getSize
public int getSize() throws MessagingExceptionGet the message size.Note that this returns RFC822.SIZE. That is, it's the size of the whole message, header and body included. Note also that if the size of the message is greater than Integer.MAX_VALUE (2GB), this method returns Integer.MAX_VALUE.
- Specified by:
getSizein interfacePart- Overrides:
getSizein classMimeMessage- Returns:
- size of content in bytes
- Throws:
MessagingException- for failures
-
getSizeLong
public long getSizeLong() throws MessagingExceptionGet the message size as a long.Suitable for messages that might be larger than 2GB.
- Returns:
- the message size as a long integer
- Throws:
MessagingException- for failures- Since:
- JavaMail 1.6
-
getLineCount
public int getLineCount() throws MessagingExceptionGet the total number of lines.Returns the "body_fld_lines" field from the BODYSTRUCTURE. Note that this field is available only for text/plain and message/rfc822 types
- Specified by:
getLineCountin interfacePart- Overrides:
getLineCountin classMimeMessage- Returns:
- number of lines in the content.
- Throws:
MessagingException- for failures
-
getContentLanguage
public java.lang.String[] getContentLanguage() throws MessagingExceptionGet the content language.- Specified by:
getContentLanguagein interfaceMimePart- Overrides:
getContentLanguagein classMimeMessage- Returns:
- value of content-language header.
- Throws:
MessagingException- for failures
-
setContentLanguage
public void setContentLanguage(java.lang.String[] languages) throws MessagingExceptionDescription copied from class:MimeMessageSet the "Content-Language" header of this MimePart. The Content-Language header is defined by RFC 1766.- Specified by:
setContentLanguagein interfaceMimePart- Overrides:
setContentLanguagein classMimeMessage- Parameters:
languages- array of language tags- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures
-
getInReplyTo
public java.lang.String getInReplyTo() throws MessagingExceptionGet the In-Reply-To header.- Returns:
- the In-Reply-To header
- Throws:
MessagingException- for failures- Since:
- JavaMail 1.3.3
-
getContentType
public java.lang.String getContentType() throws MessagingExceptionGet the Content-Type. Generate this header from the BODYSTRUCTURE. Append parameters as well.- Specified by:
getContentTypein interfacePart- Overrides:
getContentTypein classMimeMessage- Returns:
- The ContentType of this part
- Throws:
MessagingException- for failures- See Also:
DataHandler
-
getDisposition
public java.lang.String getDisposition() throws MessagingExceptionGet the Content-Disposition.- Specified by:
getDispositionin interfacePart- Overrides:
getDispositionin classMimeMessage- Returns:
- disposition of this part, or null if unknown
- Throws:
MessagingException- for failures- See Also:
Part.ATTACHMENT,Part.INLINE,Part.getFileName()
-
setDisposition
public void setDisposition(java.lang.String disposition) throws MessagingExceptionDescription copied from class:MimeMessageSet the disposition in the "Content-Disposition" header field of this body part. If the disposition is null, any existing "Content-Disposition" header field is removed.- Specified by:
setDispositionin interfacePart- Overrides:
setDispositionin classMimeMessage- Parameters:
disposition- disposition of this part- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures- See Also:
Part.ATTACHMENT,Part.INLINE,Part.setFileName(java.lang.String)
-
getEncoding
public java.lang.String getEncoding() throws MessagingExceptionGet the Content-Transfer-Encoding.- Specified by:
getEncodingin interfaceMimePart- Overrides:
getEncodingin classMimeMessage- Returns:
- content-transfer-encoding
- Throws:
MessagingException- for failures
-
getContentID
public java.lang.String getContentID() throws MessagingExceptionGet the Content-ID.- Specified by:
getContentIDin interfaceMimePart- Overrides:
getContentIDin classMimeMessage- Returns:
- content-ID
- Throws:
MessagingException- for failures
-
setContentID
public void setContentID(java.lang.String cid) throws MessagingExceptionDescription copied from class:MimeMessageSet the "Content-ID" header field of this Message. If thecidparameter is null, any existing "Content-ID" is removed.- Overrides:
setContentIDin classMimeMessage- Parameters:
cid- the content ID- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures
-
getContentMD5
public java.lang.String getContentMD5() throws MessagingExceptionGet the Content-MD5.- Specified by:
getContentMD5in interfaceMimePart- Overrides:
getContentMD5in classMimeMessage- Returns:
- content-MD5
- Throws:
MessagingException- for failures
-
setContentMD5
public void setContentMD5(java.lang.String md5) throws MessagingExceptionDescription copied from class:MimeMessageSet the "Content-MD5" header field of this Message.- Specified by:
setContentMD5in interfaceMimePart- Overrides:
setContentMD5in classMimeMessage- Parameters:
md5- the MD5 value- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures
-
getDescription
public java.lang.String getDescription() throws MessagingExceptionGet the decoded Content-Description.- Specified by:
getDescriptionin interfacePart- Overrides:
getDescriptionin classMimeMessage- Returns:
- content-description
- Throws:
MessagingException- for failures
-
setDescription
public void setDescription(java.lang.String description, java.lang.String charset) throws MessagingExceptionDescription copied from class:MimeMessageSet the "Content-Description" header field for this Message. If the description parameter isnull, then any existing "Content-Description" fields are removed.If the description contains non US-ASCII characters, it will be encoded using the specified charset. If the description contains only US-ASCII characters, no encoding is done and it is used as-is.
Note that if the charset encoding process fails, a MessagingException is thrown, and an UnsupportedEncodingException is included in the chain of nested exceptions within the MessagingException.
- Overrides:
setDescriptionin classMimeMessage- Parameters:
description- Descriptioncharset- Charset for encoding- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- An UnsupportedEncodingException may be included in the exception chain if the charset conversion fails.
-
getMessageID
public java.lang.String getMessageID() throws MessagingExceptionGet the Message-ID.- Overrides:
getMessageIDin classMimeMessage- Returns:
- Message-ID
- Throws:
MessagingException- if the retrieval of this field causes any exception.- See Also:
MessageIDTerm
-
getFileName
public java.lang.String getFileName() throws MessagingExceptionGet the "filename" Disposition parameter. (Only available in IMAP4rev1). If thats not available, get the "name" ContentType parameter.- Specified by:
getFileNamein interfacePart- Overrides:
getFileNamein classMimeMessage- Returns:
- filename
- Throws:
MessagingException- for failures
-
setFileName
public void setFileName(java.lang.String filename) throws MessagingExceptionDescription copied from class:MimeMessageSet the filename associated with this part, if possible.Sets the "filename" parameter of the "Content-Disposition" header field of this message.
If the
mail.mime.encodefilenameSystem property is set to true, theMimeUtility.encodeTextmethod will be used to encode the filename. While such encoding is not supported by the MIME spec, many mailers use this technique to support non-ASCII characters in filenames. The default value of this property is false.- Specified by:
setFileNamein interfacePart- Overrides:
setFileNamein classMimeMessage- Parameters:
filename- Filename to associate with this part- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures
-
getDataHandler
public javax.activation.DataHandler getDataHandler() throws MessagingExceptionGet the DataHandler object for this message.- Specified by:
getDataHandlerin interfacePart- Overrides:
getDataHandlerin classMimeMessage- Returns:
- DataHandler for the content
- Throws:
MessagingException- for failures
-
setDataHandler
public void setDataHandler(javax.activation.DataHandler content) throws MessagingExceptionDescription copied from class:MimeMessageThis method provides the mechanism to set this part's content. The given DataHandler object should wrap the actual content.- Specified by:
setDataHandlerin interfacePart- Overrides:
setDataHandlerin classMimeMessage- Parameters:
content- The DataHandler for the content.- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures
-
getMimeStream
public java.io.InputStream getMimeStream() throws MessagingExceptionReturn the MIME format stream corresponding to this message.- Specified by:
getMimeStreamin interfaceReadableMime- Returns:
- the MIME format stream
- Throws:
MessagingException- for failures- Since:
- JavaMail 1.4.5
-
writeTo
public void writeTo(java.io.OutputStream os) throws java.io.IOException, MessagingExceptionWrite out the bytes into the given OutputStream.- Specified by:
writeToin interfacePart- Overrides:
writeToin classMimeMessage- Parameters:
os- the stream to write to- Throws:
java.io.IOException- if an error occurs writing to the stream or if an error is generated by the javax.activation layer.MessagingException- for other failures- See Also:
DataHandler.writeTo(java.io.OutputStream)
-
getHeader
public java.lang.String[] getHeader(java.lang.String name) throws MessagingExceptionGet the named header.- Specified by:
getHeaderin interfacePart- Overrides:
getHeaderin classMimeMessage- Parameters:
name- name of header- Returns:
- array of headers
- Throws:
MessagingException- for failures- See Also:
MimeUtility
-
getHeader
public java.lang.String getHeader(java.lang.String name, java.lang.String delimiter) throws MessagingExceptionGet the named header.- Specified by:
getHeaderin interfaceMimePart- Overrides:
getHeaderin classMimeMessage- Parameters:
name- the name of this headerdelimiter- separator between values- Returns:
- the value fields for all headers with this name
- Throws:
MessagingException- for failures
-
setHeader
public void setHeader(java.lang.String name, java.lang.String value) throws MessagingExceptionDescription copied from class:MimeMessageSet the value for this header_name. Replaces all existing header values with this new value. Note that RFC 822 headers must contain only US-ASCII characters, so a header that contains non US-ASCII characters must have been encoded by the caller as per the rules of RFC 2047.- Specified by:
setHeaderin interfacePart- Overrides:
setHeaderin classMimeMessage- Parameters:
name- header namevalue- header value- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures- See Also:
MimeUtility
-
addHeader
public void addHeader(java.lang.String name, java.lang.String value) throws MessagingExceptionDescription copied from class:MimeMessageAdd this value to the existing values for this header_name. Note that RFC 822 headers must contain only US-ASCII characters, so a header that contains non US-ASCII characters must have been encoded as per the rules of RFC 2047.- Specified by:
addHeaderin interfacePart- Overrides:
addHeaderin classMimeMessage- Parameters:
name- header namevalue- header value- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures- See Also:
MimeUtility
-
removeHeader
public void removeHeader(java.lang.String name) throws MessagingExceptionDescription copied from class:MimeMessageRemove all headers with this name.- Specified by:
removeHeaderin interfacePart- Overrides:
removeHeaderin classMimeMessage- Parameters:
name- the name of this header- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures
-
getAllHeaders
public java.util.Enumeration<Header> getAllHeaders() throws MessagingException
Get all headers.- Specified by:
getAllHeadersin interfacePart- Overrides:
getAllHeadersin classMimeMessage- Returns:
- array of header objects
- Throws:
MessagingException- for failures- See Also:
MimeUtility
-
getMatchingHeaders
public java.util.Enumeration<Header> getMatchingHeaders(java.lang.String[] names) throws MessagingException
Get matching headers.- Specified by:
getMatchingHeadersin interfacePart- Overrides:
getMatchingHeadersin classMimeMessage- Parameters:
names- the headers to match- Returns:
- enumeration of Header objects
- Throws:
MessagingException- for failures
-
getNonMatchingHeaders
public java.util.Enumeration<Header> getNonMatchingHeaders(java.lang.String[] names) throws MessagingException
Get non-matching headers.- Specified by:
getNonMatchingHeadersin interfacePart- Overrides:
getNonMatchingHeadersin classMimeMessage- Parameters:
names- the headers to not match- Returns:
- enumeration of Header objects
- Throws:
MessagingException- for failures
-
addHeaderLine
public void addHeaderLine(java.lang.String line) throws MessagingExceptionDescription copied from class:MimeMessageAdd a raw RFC 822 header-line.- Specified by:
addHeaderLinein interfaceMimePart- Overrides:
addHeaderLinein classMimeMessage- Parameters:
line- the line to add- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures
-
getAllHeaderLines
public java.util.Enumeration<java.lang.String> getAllHeaderLines() throws MessagingExceptionGet all header-lines.- Specified by:
getAllHeaderLinesin interfaceMimePart- Overrides:
getAllHeaderLinesin classMimeMessage- Returns:
- an Enumeration of Strings
- Throws:
MessagingException- for failures
-
getMatchingHeaderLines
public java.util.Enumeration<java.lang.String> getMatchingHeaderLines(java.lang.String[] names) throws MessagingExceptionGet all matching header-lines.- Specified by:
getMatchingHeaderLinesin interfaceMimePart- Overrides:
getMatchingHeaderLinesin classMimeMessage- Parameters:
names- the headers to return- Returns:
- an Enumeration of Strings
- Throws:
MessagingException- for failures
-
getNonMatchingHeaderLines
public java.util.Enumeration<java.lang.String> getNonMatchingHeaderLines(java.lang.String[] names) throws MessagingExceptionGet all non-matching headerlines.- Specified by:
getNonMatchingHeaderLinesin interfaceMimePart- Overrides:
getNonMatchingHeaderLinesin classMimeMessage- Parameters:
names- the headers to not return- Returns:
- an Enumeration of Strings
- Throws:
MessagingException- for failures
-
getFlags
public Flags getFlags() throws MessagingException
Get the Flags for this message.- Overrides:
getFlagsin classMimeMessage- Returns:
- Flags object containing the flags for this message
- Throws:
MessagingException- for failures- See Also:
Flags
-
isSet
public boolean isSet(Flags.Flag flag) throws MessagingException
Test if the given Flags are set in this message.- Overrides:
isSetin classMimeMessage- Parameters:
flag- the flag- Returns:
- value of the specified flag for this message
- Throws:
MessagingException- for failures- See Also:
Flags.Flag,Flags.Flag.ANSWERED,Flags.Flag.DELETED,Flags.Flag.DRAFT,Flags.Flag.FLAGGED,Flags.Flag.RECENT,Flags.Flag.SEEN
-
setFlags
public void setFlags(Flags flag, boolean set) throws MessagingException
Set/Unset the given flags in this message.- Overrides:
setFlagsin classMimeMessage- Parameters:
flag- Flags object containing the flags to be setset- the value to be set- Throws:
IllegalWriteException- if the underlying implementation does not support modificationMessagingException- for other failures- See Also:
MessageChangedEvent
-
setPeek
public void setPeek(boolean peek)
Set whether or not to use the PEEK variant of FETCH when fetching message content. This overrides the default value from the "mail.imap.peek" property.- Parameters:
peek- the peek flag- Since:
- JavaMail 1.3.3
-
getPeek
public boolean getPeek()
Get whether or not to use the PEEK variant of FETCH when fetching message content.- Returns:
- the peek flag
- Since:
- JavaMail 1.3.3
-
invalidateHeaders
public void invalidateHeaders()
Invalidate cached header and envelope information for this message. Subsequent accesses of this information will cause it to be fetched from the server.- Since:
- JavaMail 1.3.3
-
getItem
public java.lang.Object getItem(FetchItem fitem) throws MessagingException
Return the data associated with the FetchItem. If the data hasn't been fetched, call the fetchItem method to fetch it. Returns null if there is no data for the FetchItem.- Parameters:
fitem- the FetchItem- Returns:
- the data associated with the FetchItem
- Throws:
MessagingException- for failures- Since:
- JavaMail 1.4.6
-
-