|
Compoze Software, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines a mail message. A message can be obtained from a folder.
A new message for sending can be created by using
ISession.createMessage()
. Prepare the message
and then call send()
.
To reply, reply to all recipients or forward a message,
use reply()
, replyAll()
or forward()
.
Field Summary | |
static int |
MESSAGE_RECIPIENT_BCC
Recipient is a "Bcc" address. |
static int |
MESSAGE_RECIPIENT_CC
Recipient is a "Cc" address. |
static int |
MESSAGE_RECIPIENT_TO
Recipient is a "To" address. |
Method Summary | |
void |
addAttachment(FileAttachment file)
Adds a file attachment to this message. |
void |
addAttachments(FileAttachment[] files)
Adds the file attachments to this message. |
void |
addHeader(java.lang.String sName,
java.lang.String sValue)
Adds the value to the existing values for this header name. |
void |
addRecipients(int type,
IMailAddress[] addresses)
Adds these recipient addresses to the existing ones of the given type. |
void |
delete()
Deletes the message from the underlying store. |
void |
delete(boolean bDeletedFolder)
Deletes the message from the underlying store. |
IMessage |
forward()
Forwards the message. |
java.util.Map |
getAllHeaders()
Gets a map of all the header values. |
IAttachment |
getAttachment(java.lang.String sFilename)
Gets a file attachment from the message by the specified name. |
IAttachment[] |
getAttachments()
Gets all file attachments for this message. |
IAttachment[] |
getAttachments(boolean bLoadData)
Gets all file attachments for this message. |
IMailAddress[] |
getBcc()
Gets the "Bcc" addresses for the recipient of the message. |
java.lang.String |
getBccString()
Gets the "Bcc" attribute in printable form. |
Body |
getBody()
Gets the message body. |
IMailAddress[] |
getCc()
Gets the "Cc" addresses for the recipient of the message. |
java.lang.String |
getCcString()
Gets the "Cc" attribute in printable form. |
java.lang.Object |
getFolderID()
Gets the folder id from which this message was obtained. |
IMailAddress[] |
getFrom()
Gets the "From" addresses for the sender of the message. |
java.lang.String |
getFromString()
Gets the "From" attribute in printable form. |
java.lang.String |
getHeaderValue(java.lang.String sName)
Gets a single header value for the specified header name. |
java.lang.String[] |
getHeaderValues(java.lang.String sName)
Gets all the header values for the specified header name. |
java.lang.Object |
getID()
Gets the ID of this message. |
java.util.Date |
getReceivedDate()
Gets the date this message was received. |
java.lang.String |
getReceivedDateString(java.text.DateFormat dateFormat)
Gets the displayable received date using the specified date format. |
java.util.List |
getRecipients(int type)
Gets the recipients of the specified type. |
java.util.Date |
getSentDate()
Gets the date this message was sent. |
java.lang.String |
getSentDateString(java.text.DateFormat dateFormat)
Gets the displayable sent date using the specified date format. |
int |
getSize()
Gets the size of this message in bytes. |
java.lang.String |
getSizeKilos()
Gets the size of this message in kilobytes. |
java.lang.String |
getSubject()
Gets the subject of this message. |
java.lang.String |
getSubject(int iLength)
Gets the subject of the message. |
java.lang.String |
getSubject(java.util.Locale locale)
Gets the subject of this message. |
java.lang.String |
getSubject(java.util.Locale locale,
int iLength)
Gets the subject of the message. |
IMailAddress[] |
getTo()
Gets the "To" addresses for the recipient of the message. |
java.lang.String |
getToString()
Gets the "To" attribute in printable form. |
boolean |
hasAttachments()
Checks if the messages has attachments. |
boolean |
isHighPriority()
Checks whether the message is high priority. |
boolean |
isUnread()
Checks whether the message is unread. |
void |
move(java.lang.Object folderID)
Moves the message to the folder with the specified ID. |
void |
removeHeader(java.lang.String sName)
Removes all headers with this name. |
boolean |
removeRecipient(int type,
IMailAddress address)
Removes this recipient address from the existing ones. |
IMessage |
reply()
Replies to the message. |
IMessage |
replyAll()
Replies to the message. |
void |
saveDraft()
Saves the message in the Drafts folder. |
void |
send()
Sends the message. |
void |
send(boolean bSaveSent)
Sends the message. |
void |
send(boolean bSaveSent,
IMailAddress from)
Sends the message with the specified from address. |
void |
setBody(Body body)
Sets the body of this message. |
void |
setHeader(java.lang.String sName,
java.lang.String sValue)
Sets the value for this header name. |
void |
setHighPriority(boolean bFlag)
Sets the high priority flag for this message. |
void |
setSubject(java.lang.String sSubject)
Sets the subject of this message. |
Field Detail |
public static final int MESSAGE_RECIPIENT_TO
public static final int MESSAGE_RECIPIENT_CC
public static final int MESSAGE_RECIPIENT_BCC
Method Detail |
public void setSubject(java.lang.String sSubject) throws MailException
MailException
is thrown if this is not a new message.sSubject
- the subject of this message (must be UTF-8 encoding)public java.lang.String getSubject() throws MailException
message.no_subject
property from mail_resources.properties
if the subject
is null
or zero length.public java.lang.String getSubject(java.util.Locale locale) throws MailException
message.no_subject
property from mail_resources.properties
if the subject
is null
or zero length.
The locale is used to determine the
(no subject)
message if the actual message
subject is null
or empty. The (no subject)
string is configurable in mail_resources.properties
.
locale
- the locale to use (may not be null
)public java.lang.String getSubject(int iLength) throws MailException
iLength
- the maximum length of the result (string plus "...")public java.lang.String getSubject(java.util.Locale locale, int iLength) throws MailException
The locale is used to determine the
(no subject)
message if the actual message
subject is null
or empty. The (no subject)
string is configurable in mail_resources.properties
.
locale
- the locale to use (may not be null
)iLength
- the maximum length of the result (string plus "...")public java.lang.String getSentDateString(java.text.DateFormat dateFormat) throws MailException
dateFormat
- the date format to use when formating the sent date (may not be null
)public java.util.Date getSentDate() throws MailException
null
if not availablepublic java.lang.String getReceivedDateString(java.text.DateFormat dateFormat) throws MailException
dateFormat
- the date format to use when formating the received date (may not be null
)public java.util.Date getReceivedDate() throws MailException
null
if not availablepublic Body getBody() throws MailException
public void setBody(Body body) throws MailException
MailException
is thrown if this is not a new message.body
- the body of this message (may not be null
)public java.lang.String getFromString() throws MailException
MailException
- an error occurs retrieving From recipients from the messagepublic IMailAddress[] getFrom() throws MailException
MailException
- an error occurs retrieving From recipients from the messagepublic IMailAddress[] getTo() throws MailException
MailException
- an error occurs retrieving To recipients from the messagepublic java.lang.String getToString() throws MailException
MailException
- an error occurs retrieving To recipients from the messagepublic IMailAddress[] getCc() throws MailException
MailException
- an error occurs retrieving Cc recipients from the messagepublic void addRecipients(int type, IMailAddress[] addresses) throws MailException
type
- the recipient type (see MESSAGE_RECIPIENT_
constants);addresses
- the addressesMailException
- an error occurs retrieving Cc recipients from the messagepublic java.util.List getRecipients(int type) throws MailException
type
- the recipient type (see MESSAGE_RECIPIENT_
constants);IMailAddress
objects or an empty list if no recipients of that type existMailException
- an error occurs retrieving Cc recipients from the messagepublic boolean removeRecipient(int type, IMailAddress address) throws MailException
type
- the recipient type (see MESSAGE_RECIPIENT_
constants);address
- the address to removetrue
if the recipient existed and was removed; false
otherwiseMailException
- an error occurs retrieving Cc recipients from the messagepublic java.lang.String getCcString() throws MailException
MailException
- an error occurs retrieving Cc recipients from the messagepublic IMailAddress[] getBcc() throws MailException
MailException
- an error occurs retrieving Bcc recipients from the messagepublic int getSize() throws MailException
public java.lang.String getSizeKilos() throws MailException
public java.lang.String getBccString() throws MailException
MailException
- an error occurs retrieving Bcc recipients from the messagepublic void delete() throws MailException
public void delete(boolean bDeletedFolder) throws MailException
bDeletedFolder
- true
to move the message to the deleted folder; false
otherwisepublic boolean isHighPriority() throws MailException
true
if this message is high priority; false
otherwisepublic void setHighPriority(boolean bFlag) throws MailException
MailException
is thrown if this is not a new message.bFlag
- true
if this message is to be sent with high priority; false
otherwisepublic boolean isUnread() throws MailException
true
if this message is unread; false
otherwisepublic java.lang.Object getID() throws MailException
public IMessage reply() throws MailException
public IMessage replyAll() throws MailException
public IMessage forward() throws MailException
public void saveDraft() throws MailException
public void send() throws MailException
public void send(boolean bSaveSent) throws MailException
bSaveSent
- true
to save a copy of the message in Sent folder; false
otherwisepublic void send(boolean bSaveSent, IMailAddress from) throws MailException
bSaveSent
- true
to save a copy of the message in Sent folder; false
otherwiseaddress
- the from address. If null
, the connection ISession.CONNPROP_FROM
is usedpublic java.lang.String getHeaderValue(java.lang.String sName) throws MailException
null
is returned.sName
- the name of this headernull
if the header does not existgetHeaderValues(String)
public java.lang.String[] getHeaderValues(java.lang.String sName) throws MailException
sName
- the name of this headerpublic java.util.Map getAllHeaders() throws MailException
public void addHeader(java.lang.String sName, java.lang.String sValue) throws MailException
sName
- the name of the header to add tosValue
- the value of the headerpublic void setHeader(java.lang.String sName, java.lang.String sValue) throws MailException
sName
- the name of the header to setsValue
- the value of the headerpublic void removeHeader(java.lang.String sName) throws MailException
sName
- the name of the header to removepublic boolean hasAttachments() throws MailException
true
if this message has attachments. The test
for attachments is by checking the MIME type of
the message. A message is considered to have attachments
if the MIME type is multipart/*
.true
if this message has attachments; false
otherwisepublic IAttachment[] getAttachments() throws MailException
getAttachments(boolean)
to
optionally retrieve only the attachment shells.public IAttachment[] getAttachments(boolean bLoadData) throws MailException
bLoadData
- true
to load the attachment data; false
to only load summary datapublic IAttachment getAttachment(java.lang.String sFilename) throws MailException
sFilename
- the name of the file attachmentnull
if the file attachment does not existpublic void addAttachment(FileAttachment file) throws MailException
file
- the file to attach (may not be null
)MailException
- an error occurs adding the file attachmentpublic void addAttachments(FileAttachment[] files) throws MailException
files
- an array of files to attach (may not be null
)MailException
- an error occurs adding the file attachmentpublic java.lang.Object getFolderID() throws MailException
null
.
This only returns the ID of the message, instead of the folder
itself. This helps to reduce overhead by not carrying around the reference
if it is not needed.null
if this is a new messagepublic void move(java.lang.Object folderID) throws MailException
folderID
- the folder ID
|
Compoze Software, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |