Compoze Software, Inc.

com.compoze.mail
Interface IMessageAttachment

All Superinterfaces:
IAttachment, java.io.Serializable

public interface IMessageAttachment
extends IAttachment

This interface defines an attachment that itself, is a mail message.


Method Summary
 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 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.
 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 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.
 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.
 
Methods inherited from interface com.compoze.mail.IAttachment
getBytes, getContentType, getName, getSize, getSizeKilos
 

Method Detail

getSubject


public java.lang.String getSubject()
                            throws MailException
Gets the subject of this message. Returns the message.no_subject property from mail_resources.properties if the subject is null or zero length.
Returns:
the subject of this message

getSubject


public java.lang.String getSubject(java.util.Locale locale)
                            throws MailException
Gets the subject of this message. Returns the 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.

Parameters:
locale - the locale to use (may not be null)
Returns:
the subject of this message

getSubject


public java.lang.String getSubject(int iLength)
                            throws MailException
Gets the subject of the message. The subject is truncated after the specified number of characters and "..." is appended to it.
Parameters:
iLength - the maximum length of the result (string plus "...")
Returns:
the truncated subject of the message

getSubject


public java.lang.String getSubject(java.util.Locale locale,
                                   int iLength)
                            throws MailException
Gets the subject of the message. The subject is truncated after the specified number of characters and "..." is appended to it.

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.

Parameters:
locale - the locale to use (may not be null)
iLength - the maximum length of the result (string plus "...")
Returns:
the truncated subject of the message

getSentDateString


public java.lang.String getSentDateString(java.text.DateFormat dateFormat)
                                   throws MailException
Gets the displayable sent date using the specified date format.
Parameters:
dateFormat - the date format to use when formating the sent date (may not be null)
Returns:
the sent date in displayable string form

getSentDate


public java.util.Date getSentDate()
                           throws MailException
Gets the date this message was sent.
Returns:
the sent date or null if not available

getBody


public Body getBody()
             throws MailException
Gets the message body.
Returns:
the message body

getFromString


public java.lang.String getFromString()
                               throws MailException
Gets the "From" attribute in printable form.
Returns:
the "From" attribute
Throws:
MailException - an error occurs retrieving From recipients from the message

getFrom


public IMailAddress[] getFrom()
                       throws MailException
Gets the "From" addresses for the sender of the message.
Returns:
an array of "From" addresses
Throws:
MailException - an error occurs retrieving From recipients from the message

getTo


public IMailAddress[] getTo()
                     throws MailException
Gets the "To" addresses for the recipient of the message.
Returns:
an array of "To" addresses
Throws:
MailException - an error occurs retrieving To recipients from the message

getToString


public java.lang.String getToString()
                             throws MailException
Gets the "To" attribute in printable form.
Returns:
the "To" attribute
Throws:
MailException - an error occurs retrieving To recipients from the message

getCc


public IMailAddress[] getCc()
                     throws MailException
Gets the "Cc" addresses for the recipient of the message.
Returns:
an array of "Cc" addresses
Throws:
MailException - an error occurs retrieving Cc recipients from the message

getCcString


public java.lang.String getCcString()
                             throws MailException
Gets the "Cc" attribute in printable form.
Returns:
the "Cc" attribute
Throws:
MailException - an error occurs retrieving Cc recipients from the message

getBcc


public IMailAddress[] getBcc()
                      throws MailException
Gets the "Bcc" addresses for the recipient of the message.
Returns:
an array of "Bcc" addresses
Throws:
MailException - an error occurs retrieving Bcc recipients from the message

getBccString


public java.lang.String getBccString()
                              throws MailException
Gets the "Bcc" attribute in printable form.
Returns:
the "Bcc" attribute
Throws:
MailException - an error occurs retrieving Bcc recipients from the message

isHighPriority


public boolean isHighPriority()
                       throws MailException
Checks whether the message is high priority.
Returns:
true if this message is high priority; false otherwise

getID


public java.lang.Object getID()
                       throws MailException
Gets the ID of this message.
Returns:
the ID of this message

getHeaderValue


public java.lang.String getHeaderValue(java.lang.String sName)
                                throws MailException
Gets a single header value for the specified header name. If the header has more than one single value, the first value is returned. If the header has no values, null is returned.
Parameters:
sName - the name of this header
Returns:
the single value for all headers with this name or null if the header does not exist
See Also:
getHeaderValues(String)

getHeaderValues


public java.lang.String[] getHeaderValues(java.lang.String sName)
                                   throws MailException
Gets all the header values for the specified header name.
Parameters:
sName - the name of this header
Returns:
the values for all headers with this name or an empty array (zero length) if the header has not values

getAllHeaders


public java.util.Map getAllHeaders()
                            throws MailException
Gets a map of all the header values. The map key is the header name and the map value is an array of string values.
Returns:
a map of header names/values (unmodifiable)

hasAttachments


public boolean hasAttachments()
                       throws MailException
Checks if the messages has attachments. Returns true if this message has attachments. The test for attachmentse is by checking the MIME type of the message. A message is considered to have attachments if the MIME type is multipart/*.
Returns:
true if this message has attachments; false otherwise

getAttachments


public IAttachment[] getAttachments()
                             throws MailException
Gets all attachments for this message. This method loads the file attachment data, which could be costly if you are only interested in attachment summary data (filename, content-type). Use getAttachments(boolean) to optionally retrieve only the attachment shells.
Returns:
an array of attachments or an empty array if no attachments exist

getAttachments


public IAttachment[] getAttachments(boolean bLoadData)
                             throws MailException
Gets all file attachments for this message.
Parameters:
bLoadData - true to load the attachment data; false to only load summary data
Returns:
an array of file attachments or an empty array if no attachments exist

getAttachment


public IAttachment getAttachment(java.lang.String sFilename)
                          throws MailException
Gets a file attachment from the message by the specified name.
Parameters:
sFilename - the name of the file attachment
Returns:
the file attachment or null if the file attachment does not exist

Compoze Software, Inc.

Copyright ©1999-2001 Compoze Software, Inc. All rights reserved.