|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavax.mail.Message
javax.mail.internet.MimeMessage
| Nested Class Summary | |
static class |
MimeMessage.RecipientType
Extends Message.RecipientType to support addition recipient types. |
| Field Summary | |
protected byte[] |
content
This message's content (unless sourced from a SharedInputStream). |
protected java.io.InputStream |
contentStream
If the data for this message was supplied by a SharedInputStream
then this is another such stream representing the content of this message;
if this field is non-null, then content will be null. |
private MailDateFormat |
dateFormat
|
protected DataHandler |
dh
The DataHandler for this Message's content. |
protected Flags |
flags
This message's flags. |
protected InternetHeaders |
headers
This message's headers. |
protected boolean |
modified
Flag indicating that the message has been modified; set to true when an empty message is created or when saveChanges() is called. |
protected boolean |
saved
Flag indicating that the message has been saved. |
| Fields inherited from class javax.mail.Message |
expunged, folder, msgnum, session |
| Fields inherited from interface javax.mail.Part |
ATTACHMENT, INLINE |
| Constructor Summary | |
protected |
MimeMessage(Folder folder,
java.io.InputStream in,
int number)
Create a MimeMessage by reading an parsing the data from the supplied stream. |
protected |
MimeMessage(Folder folder,
int number)
Create an new MimeMessage in the supplied Folder and message number. |
protected |
MimeMessage(Folder folder,
InternetHeaders headers,
byte[] content,
int number)
Create a MimeMessage with the supplied headers and content. |
|
MimeMessage(MimeMessage message)
Copy a MimeMessage. |
|
MimeMessage(Session session)
Create a new MimeMessage. |
|
MimeMessage(Session session,
java.io.InputStream in)
Create a MimeMessage by reading an parsing the data from the supplied stream. |
| Method Summary | |
void |
addFrom(Address[] addresses)
Add multiple addresses to the "From" header. |
private void |
addHeader(java.lang.String header,
Address[] addresses)
|
void |
addHeader(java.lang.String name,
java.lang.String value)
|
void |
addHeaderLine(java.lang.String line)
|
void |
addRecipients(Message.RecipientType type,
Address[] address)
Add recipents of a specified type. |
void |
addRecipients(Message.RecipientType type,
java.lang.String address)
|
private void |
addRecipientsToList(java.util.List list,
Message.RecipientType type)
|
protected InternetHeaders |
createInternetHeaders(java.io.InputStream in)
|
java.util.Enumeration |
getAllHeaderLines()
|
java.util.Enumeration |
getAllHeaders()
|
Address[] |
getAllRecipients()
Get all recipients of this message. |
java.lang.Object |
getContent()
|
java.lang.String |
getContentID()
|
java.lang.String[] |
getContentLanguage()
|
java.lang.String |
getContentMD5()
|
protected java.io.InputStream |
getContentStream()
|
java.lang.String |
getContentType()
|
DataHandler |
getDataHandler()
|
java.lang.String |
getDescription()
|
java.lang.String |
getDisposition()
|
java.lang.String |
getEncoding()
|
java.lang.String |
getFileName()
|
Flags |
getFlags()
Return a copy the flags associated with this message. |
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. |
java.lang.String[] |
getHeader(java.lang.String name)
|
java.lang.String |
getHeader(java.lang.String name,
java.lang.String delimiter)
|
private InternetAddress[] |
getHeaderAsAddresses(java.lang.String header,
boolean strict)
|
private java.lang.String |
getHeaderForRecipientType(Message.RecipientType type)
|
java.io.InputStream |
getInputStream()
|
int |
getLineCount()
|
java.util.Enumeration |
getMatchingHeaderLines(java.lang.String[] names)
|
java.util.Enumeration |
getMatchingHeaders(java.lang.String[] names)
|
java.lang.String |
getMessageID()
|
java.util.Enumeration |
getNonMatchingHeaderLines(java.lang.String[] names)
|
java.util.Enumeration |
getNonMatchingHeaders(java.lang.String[] names)
|
java.io.InputStream |
getRawInputStream()
|
java.util.Date |
getReceivedDate()
Return the date this message was received. |
Address[] |
getRecipients(Message.RecipientType type)
Get all recipients of the given type. |
Address[] |
getReplyTo()
Get the addresses to which replies should be directed. |
Address |
getSender()
Return the "Sender" header as an address. |
java.util.Date |
getSentDate()
Return the date that this message was sent. |
private java.lang.String |
getSingleHeader(java.lang.String name)
|
int |
getSize()
|
java.lang.String |
getSubject()
Get the subject for this message. |
boolean |
isMimeType(java.lang.String type)
|
boolean |
isSet(Flags.Flag flag)
Check whether the supplied flag is set. |
private boolean |
isStrictAddressing()
|
protected void |
parse(java.io.InputStream in)
Parse the supplied stream and initialize headers and content appropriately. |
void |
removeHeader(java.lang.String name)
|
Message |
reply(boolean replyToAll)
Create a new message suitable as a reply to this message with all headers set up appropriately. |
void |
saveChanges()
To ensure changes are saved to the store, this message should be invoked before its containing folder is closed. |
void |
setContent(Multipart part)
|
void |
setContent(java.lang.Object content,
java.lang.String type)
|
void |
setContentID(java.lang.String cid)
|
void |
setContentLanguage(java.lang.String[] languages)
|
void |
setContentMD5(java.lang.String md5)
|
void |
setDataHandler(DataHandler handler)
|
void |
setDescription(java.lang.String description)
|
void |
setDescription(java.lang.String description,
java.lang.String charset)
|
void |
setDisposition(java.lang.String disposition)
|
void |
setFileName(java.lang.String name)
|
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. |
void |
setFrom()
Set the "From" header using the value returned by InternetAddress.getLocalAddress(javax.mail.Session). |
void |
setFrom(Address address)
Set the "From" header to the supplied address. |
private void |
setHeader(java.lang.String header,
Address address)
|
private void |
setHeader(java.lang.String header,
Address[] addresses)
|
void |
setHeader(java.lang.String name,
java.lang.String value)
|
void |
setRecipients(Message.RecipientType type,
Address[] addresses)
Set the list of recipients for the specified type. |
void |
setRecipients(Message.RecipientType type,
java.lang.String address)
|
void |
setReplyTo(Address[] address)
Set the addresses to which replies should be directed. |
void |
setSender(Address address)
Set the "Sender" header. |
void |
setSentDate(java.util.Date sent)
Set the date this message was sent. |
void |
setSubject(java.lang.String subject)
Set the subject of this message |
void |
setSubject(java.lang.String subject,
java.lang.String charset)
|
void |
setText(java.lang.String text)
|
void |
setText(java.lang.String text,
java.lang.String charset)
|
protected void |
updateHeaders()
|
void |
writeTo(java.io.OutputStream out)
|
void |
writeTo(java.io.OutputStream out,
java.lang.String[] ignoreHeaders)
|
| Methods inherited from class javax.mail.Message |
addRecipient, getFolder, getMessageNumber, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected DataHandler dh
DataHandler for this Message's content.
protected byte[] content
protected java.io.InputStream contentStream
SharedInputStream
then this is another such stream representing the content of this message;
if this field is non-null, then content will be null.
protected InternetHeaders headers
protected Flags flags
protected boolean modified
saveChanges() is called.
protected boolean saved
private final MailDateFormat dateFormat
| Constructor Detail |
public MimeMessage(Session session)
headers and empty flags.
The modified flag is set.
session - the session for this message
public MimeMessage(Session session,
java.io.InputStream in)
throws MessagingException
session - the session for this messagein - the stream to load from
MessagingException - if there is a problem reading or parsing the stream
public MimeMessage(MimeMessage message)
throws MessagingException
message - the message to copy
MessagingException - is there was a problem copying the message
protected MimeMessage(Folder folder,
int number)
Folder and message number.
folder - the Folder that contains the new messagenumber - the message number of the new message
protected MimeMessage(Folder folder,
java.io.InputStream in,
int number)
throws MessagingException
folder - the folder for this messagein - the stream to load fromnumber - the message number of the new message
MessagingException - if there is a problem reading or parsing the stream
protected MimeMessage(Folder folder,
InternetHeaders headers,
byte[] content,
int number)
throws MessagingException
folder - the folder for this messageheaders - the headers for the new messagecontent - the content of the new messagenumber - the message number of the new message
MessagingException - if there is a problem reading or parsing the stream| Method Detail |
protected void parse(java.io.InputStream in)
throws MessagingException
headers and content appropriately.
in - the stream to read
MessagingException - if there was a problem parsing the stream
public Address[] getFrom()
throws MessagingException
Message
getFrom in class MessageMessagingException - if there was a problem accessing the store
public void setFrom(Address address)
throws MessagingException
Message
setFrom in class Messageaddress - the address of the person who the message is from
MessagingException - if there was a problem accessing the store
public void setFrom()
throws MessagingException
InternetAddress.getLocalAddress(javax.mail.Session).
setFrom in class MessageMessagingException - if there was a problem setting the header
public void addFrom(Address[] addresses)
throws MessagingException
Message
addFrom in class Messageaddresses - the addresses to add
MessagingException - if there was a problem accessing the store
public Address getSender()
throws MessagingException
MessagingException - if there was a problem parsing the header
public void setSender(Address address)
throws MessagingException
address - the new Sender address
MessagingException - if there was a problem setting the header
public Address[] getRecipients(Message.RecipientType type)
throws MessagingException
Message
getRecipients in class Messagetype - the type of recipient to get
MessagingException - if there was a problem accessing the storeMessage.RecipientType
public Address[] getAllRecipients()
throws MessagingException
MessageMessage.getRecipients(javax.mail.Message.RecipientType)
and then concatentates the results into a single array; it returns null if no headers are defined.
getAllRecipients in class MessageMessagingException - if there was a problem accessing the store
private void addRecipientsToList(java.util.List list,
Message.RecipientType type)
throws MessagingException
MessagingException
public void setRecipients(Message.RecipientType type,
Address[] addresses)
throws MessagingException
Message
setRecipients in class Messagetype - the type of recipientaddresses - the new addresses
MessagingException - if there was a problem accessing the store
public void setRecipients(Message.RecipientType type,
java.lang.String address)
throws MessagingException
MessagingException
public void addRecipients(Message.RecipientType type,
Address[] address)
throws MessagingException
Message
addRecipients in class Messagetype - the type of recipientaddress - the addresses to add
MessagingException - if there was a problem accessing the store
public void addRecipients(Message.RecipientType type,
java.lang.String address)
throws MessagingException
MessagingException
public Address[] getReplyTo()
throws MessagingException
MessageMessage.getFrom().
getReplyTo in class MessageMessagingException - if there was a problem accessing the store
public void setReplyTo(Address[] address)
throws MessagingException
Message
setReplyTo in class Messageaddress - to which replies should be directed
MessagingException - if there was a problem accessing the store
public java.lang.String getSubject()
throws MessagingException
Message
getSubject in class MessageMessagingException - if there was a problem accessing the store
public void setSubject(java.lang.String subject)
throws MessagingException
Message
setSubject in class Messagesubject - the subject
MessagingException - if there was a problem accessing the store
public void setSubject(java.lang.String subject,
java.lang.String charset)
throws MessagingException
MessagingException
public java.util.Date getSentDate()
throws MessagingException
Message
getSentDate in class MessageMessagingException - if there was a problem accessing the store
public void setSentDate(java.util.Date sent)
throws MessagingException
Message
setSentDate in class Messagesent - the date when this message was sent
MessagingException - if there was a problem accessing the store
public java.util.Date getReceivedDate()
throws MessagingException
Message
getReceivedDate in class MessageMessagingException - if there was a problem accessing the store
public int getSize()
throws MessagingException
getSize in interface PartMessagingException
public int getLineCount()
throws MessagingException
getLineCount in interface PartMessagingException
public java.lang.String getContentType()
throws MessagingException
getContentType in interface PartMessagingException
public boolean isMimeType(java.lang.String type)
throws MessagingException
isMimeType in interface PartMessagingException
public java.lang.String getDisposition()
throws MessagingException
getDisposition in interface PartMessagingException
public void setDisposition(java.lang.String disposition)
throws MessagingException
setDisposition in interface PartMessagingException
public java.lang.String getEncoding()
throws MessagingException
getEncoding in interface MimePartMessagingException
public java.lang.String getContentID()
throws MessagingException
getContentID in interface MimePartMessagingException
public void setContentID(java.lang.String cid)
throws MessagingException
MessagingException
public java.lang.String getContentMD5()
throws MessagingException
getContentMD5 in interface MimePartMessagingException
public void setContentMD5(java.lang.String md5)
throws MessagingException
setContentMD5 in interface MimePartMessagingException
public java.lang.String getDescription()
throws MessagingException
getDescription in interface PartMessagingException
public void setDescription(java.lang.String description)
throws MessagingException
setDescription in interface PartMessagingException
public void setDescription(java.lang.String description,
java.lang.String charset)
throws MessagingException
MessagingException
public java.lang.String[] getContentLanguage()
throws MessagingException
getContentLanguage in interface MimePartMessagingException
public void setContentLanguage(java.lang.String[] languages)
throws MessagingException
setContentLanguage in interface MimePartMessagingException
public java.lang.String getMessageID()
throws MessagingException
MessagingException
public java.lang.String getFileName()
throws MessagingException
getFileName in interface PartMessagingException
public void setFileName(java.lang.String name)
throws MessagingException
setFileName in interface PartMessagingException
public java.io.InputStream getInputStream()
throws MessagingException,
java.io.IOException
getInputStream in interface PartMessagingException
java.io.IOException
protected java.io.InputStream getContentStream()
throws MessagingException
MessagingException
public java.io.InputStream getRawInputStream()
throws MessagingException
MessagingException
public DataHandler getDataHandler()
throws MessagingException
getDataHandler in interface PartMessagingException
public java.lang.Object getContent()
throws MessagingException,
java.io.IOException
getContent in interface PartMessagingException
java.io.IOException
public void setDataHandler(DataHandler handler)
throws MessagingException
setDataHandler in interface PartMessagingException
public void setContent(java.lang.Object content,
java.lang.String type)
throws MessagingException
setContent in interface PartMessagingException
public void setText(java.lang.String text)
throws MessagingException
setText in interface MimePartMessagingException
public void setText(java.lang.String text,
java.lang.String charset)
throws MessagingException
setText in interface MimePartMessagingException
public void setContent(Multipart part)
throws MessagingException
setContent in interface PartMessagingException
public Message reply(boolean replyToAll)
throws MessagingException
MessageMessage.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.
reply in class MessagereplyToAll - if true, indciates the message should be addressed to all recipients not just the sender
MessagingException - if there was a problem accessing the store
public void writeTo(java.io.OutputStream out)
throws MessagingException,
java.io.IOException
writeTo in interface PartMessagingException
java.io.IOException
public void writeTo(java.io.OutputStream out,
java.lang.String[] ignoreHeaders)
throws MessagingException,
java.io.IOException
MessagingException
java.io.IOException
public java.lang.String[] getHeader(java.lang.String name)
throws MessagingException
getHeader in interface PartMessagingException
public java.lang.String getHeader(java.lang.String name,
java.lang.String delimiter)
throws MessagingException
getHeader in interface MimePartMessagingException
public void setHeader(java.lang.String name,
java.lang.String value)
throws MessagingException
setHeader in interface PartMessagingException
public void addHeader(java.lang.String name,
java.lang.String value)
throws MessagingException
addHeader in interface PartMessagingException
public void removeHeader(java.lang.String name)
throws MessagingException
removeHeader in interface PartMessagingException
public java.util.Enumeration getAllHeaders()
throws MessagingException
getAllHeaders in interface PartMessagingException
public java.util.Enumeration getMatchingHeaders(java.lang.String[] names)
throws MessagingException
getMatchingHeaders in interface PartMessagingException
public java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names)
throws MessagingException
getNonMatchingHeaders in interface PartMessagingException
public void addHeaderLine(java.lang.String line)
throws MessagingException
addHeaderLine in interface MimePartMessagingException
public java.util.Enumeration getAllHeaderLines()
throws MessagingException
getAllHeaderLines in interface MimePartMessagingException
public java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names)
throws MessagingException
getMatchingHeaderLines in interface MimePartMessagingException
public java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names)
throws MessagingException
getNonMatchingHeaderLines in interface MimePartMessagingException
public Flags getFlags()
throws MessagingException
Message
getFlags in class MessageMessagingException - if there was a problem accessing the store
public boolean isSet(Flags.Flag flag)
throws MessagingException
MessageMessage.getFlags().
isSet in class Messageflag - the flags to check for
MessagingException - if there was a problem accessing the store
public void setFlags(Flags flags,
boolean set)
throws MessagingException
MessageFlags parameter are not affected.
setFlags in class Messageflags - the flags to modifyset - the new value of those flags
MessagingException - if there was a problem accessing the store
public void saveChanges()
throws MessagingException
Message
saveChanges in class MessageMessagingException - if there was a problem accessing the store
protected void updateHeaders()
throws MessagingException
MessagingException
protected InternetHeaders createInternetHeaders(java.io.InputStream in)
throws MessagingException
MessagingException
private InternetAddress[] getHeaderAsAddresses(java.lang.String header,
boolean strict)
throws MessagingException
MessagingExceptionprivate boolean isStrictAddressing()
private void setHeader(java.lang.String header,
Address address)
private void setHeader(java.lang.String header,
Address[] addresses)
private void addHeader(java.lang.String header,
Address[] addresses)
private java.lang.String getHeaderForRecipientType(Message.RecipientType type)
throws MessagingException
MessagingException
private java.lang.String getSingleHeader(java.lang.String name)
throws MessagingException
MessagingException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||