net.rim.blackberry.api.mail
Class Message

java.lang.Object
  extended by net.rim.blackberry.api.mail.Message
All Implemented Interfaces:
Part

public class Message
extends Object
implements Part

Represents an email message.

The Message class implements the Part interface. A message contains a set of header fields (attributes) and a body (contents). Messages in a folder also have a set of flags that describe its state within the folder.

Message defines some new attributes in addition to those defined in the Part interface. These attributes provide addressing and descriptive information about the message.

Message objects can be obtained from a Folder object. Received messages are normally retrieved from a folder named "INBOX". A message obtained from a folder is just a reference to the actual message. The message is filled up on demand when each item is requested from the message. Note that certain folder implementations might return Message objects that are pre-filled with certain user-specified items.

To send a message, create a Message object, fill in the attributes and content, and invoke Transport.send(net.rim.blackberry.api.mail.Message).

See Also:
Address
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Nested Class Summary
Category: Signed static interface Message.Flag
          Defines the flags supported by the Message class.
Category: Signed static interface Message.Icons
          Defines character representations of the various message status icons.
Category: Signed static interface Message.Priority
          Defines priorities for messages.
Category: Signed static interface Message.RecipientType
          Defines the types of recipients supported by the Message class.
Category: Signed static interface Message.Status
          Defines the status options supported by the Message class.
 
Field Summary
Category: Signed static int EMAIL_MESSAGE
           
Category: Signed static int PIN_MESSAGE
          NOTE: Not in 3.8 version software
 
Fields inherited from interface net.rim.blackberry.api.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
Category: Signed Message()
          Creates a new Message instance.
Category: Signed Message(Folder folder)
          Creates a new Message to store in a provided folder.
 
Method Summary
Category: Signed  void addHeader(String header, String value)
          Adds a value to list of values for header by name.
Category: Signed  void addMessageListener(MessageListener listener)
          Adds a message listener to this message.
Category: Signed  void addRecipient(int type, Address address)
          Adds the specified address as a recipient of this message of the specified type.
Category: Signed  void addRecipients(int type, Address[] addresses)
          Adds recipient addresses.
Category: Signed  void clearFlags(int mask)
          Clears flags for this message.
Category: Signed  boolean equals(Object o)
          Determines if two object instances are the same.
Category: Signed  Message forward()
          Creates a new message object suitable for forwarding this message.
Category: Signed  Enumeration getAllHeaders()
          Retrieves all the headers from this part as an enumeration of Header objects.
Category: Signed  String getBodyText()
          Retrieves the body text for this message.
Category: Signed  Object getContent()
          Retrieves this message's body content.
Category: Signed  String getContentType()
          Retrieves this message's content-type.
Category: Signed  int getFlags()
          Retrieves the flags for this message.
Category: Signed  Folder getFolder()
          Retrieves the folder containing this message.
Category: Signed  Address getFrom()
          Retrieves this message's "From" attribute.
Category: Signed  String[] getHeader(String header)
          Retrieves all headers by name.
Category: Signed  InputStream getInputStream()
          Retrieves an input stream for this message's contents.
Category: Signed  int getMessageId()
          Retrieves the integer ID of this message.
Category: Signed  int getMessageType()
          Returns the type of message
Category: Signed  byte getPriority()
          Returns the priority of the Message.
Category: Signed  Date getReceivedDate()
          Retrieves the received-date for this message.
Category: Signed  Address[] getRecipients(int type)
          Retrieves all the recipient addresses for the message based on recipient type.
Category: Signed  Address[] getReplyTo()
          Retrieves the addresses to which replies should be directed.
Category: Signed  Date getSentDate()
          Retrieves the sent-date for this message.
Category: Signed  int getSize()
          Retrieves the size for this message's content.
Category: Signed  int getStatus()
          Retrieves the status of this message.
Category: Signed  String getSubject()
          Retrieves the subject of this message.
Category: Signed  int getTransmissionError()
          Retrieves the transmission error code for this message.
Category: Signed  int hashCode()
          Retrieves a hash code value for this message.
Category: Signed  boolean isInbound()
          Determines if this message is an inbound (received) message.
Category: Signed  boolean isMimeType(String mimeType)
          Determines if this message's content-type matches provided type.
Category: Signed  boolean isSet(int flag)
          Determines if the specified flag is set on this message.
Category: Signed  boolean removeAllRecipients(int type)
          Removes all the recipients of the type specified.
Category: Signed  void removeHeader(String header)
          Removes all headers by name.
Category: Signed  void removeMessageListener(MessageListener listener)
          Removes a message listener from this message.
Category: Signed  boolean removeRecipients(int type, Address[] list)
          Removes all the recipients of the type specified from the array of Addresses
Category: Signed  Message reply(boolean replyToAll)
          Retrieves a new message object suitable for a reply to this message.
Category: Signed  Message reply(boolean replyToAll, boolean replyWithOriginalText)
          Retrieves a new message object suitable for a reply to this message.
Category: Signed  void setContent(Object content)
          Sets the contents (body) for this message.
Category: Signed  void setFlag(int flag, boolean set)
          Sets or clears the specified flag on this message.
Category: Signed  void setFlags(int mask)
          Sets flags for this message.
Category: Signed  void setFrom(Address address)
          Sets this message's "From" attribute.
Category: Signed  void setHeader(String header, String value)
          Sets a value for header by name.
Category: Signed  void setInbound(boolean b)
          Sets the message status as an inbound (received) message.
Category: Signed  void setPriority(byte p)
          Sets the priority of the message.
Category: Signed  void setReplyTo(Address[] addresses)
          Sets the addresses to which replies should be directed.
Category: Signed  void setSentDate(Date date)
          Sets the sent-date for this message.
Category: Signed  void setStatus(int messageStatus, int messageTransmissionError)
          Sets the status for this message.
Category: Signed  void setSubject(String subject)
          Sets the subject for this message.
Category: Signed  void updateUi()
          Initiates any necessary UI updates.
Category: Signed  void writeTo(OutputStream os)
          Writes this message out as an RFC 822 format stream.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

PIN_MESSAGE

public static final int PIN_MESSAGE
NOTE: Not in 3.8 version software

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

EMAIL_MESSAGE

public static final int EMAIL_MESSAGE
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0


Constructor Detail

Message

public Message()
Creates a new Message instance.

Events on the message, such as status changes, are not distributed until this message is added to a folder, or sent using Transport.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Message

public Message(Folder folder)
Creates a new Message to store in a provided folder.

Events on the message, such as status changes, are not distributed until this message is added to a folder, or sent via Transport.

Note: This method does not add the message to the folder, it merely associates it for later transport.

Parameters:
folder - Folder in which to create this new message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0


Method Detail

getFolder

public Folder getFolder()
Retrieves the folder containing this message.

Returns:
Folder containing this message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setFrom

public void setFrom(Address address)
Sets this message's "From" attribute.

Parameters:
address - "From" (sender) address for this message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getFrom

public Address getFrom()
                throws MessagingException
Retrieves this message's "From" attribute.

Returns:
Address in this message's "From" (sender) attribute, or null if no "From" attribute set.
Throws:
MessagingException - A general messaging error.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

removeAllRecipients

public boolean removeAllRecipients(int type)
                            throws MessagingException
Removes all the recipients of the type specified.

Parameters:
type - Type should be one of RecipientType.BCC or RecipientType.CC or RecipientType.TO
Returns:
true if successful
Throws:
MessagingException - If the recipient type is not RecipientType.BCC or RecipientType.CC or RecipientType.TO
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

removeRecipients

public boolean removeRecipients(int type,
                                Address[] list)
                         throws MessagingException
Removes all the recipients of the type specified from the array of Addresses

Parameters:
type - Type should be one of RecipientType.BCC or RecipientType.CC or RecipientType.TO
list - Array of Addresses
Returns:
true if successful
Throws:
MessagingException - If the recipient type is not RecipientType.BCC or RecipientType.CC or RecipientType.TO
NullPointerException - If the Address array is null
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.1.0

addRecipient

public void addRecipient(int type,
                         Address address)
                  throws MessagingException
Adds the specified address as a recipient of this message of the specified type.

This is equivalent to addRecipients(type, new Address[] {address}).

Parameters:
type - Type of message recipient. Should be one of the following types: TO, CC, or BCC.
address - the address of the recipient to add.
Throws:
IllegalArgumentException - if any of the following conditions is true:
  • address is null
  • the type parameter is not one of the following types: TO, CC, or BCC
MessagingException - if any of the following conditions is true:
  • if message recipient type is BCC but the IT Policy does not allow BCC
  • if the address being added is of PIN type address, while previously added addresses were of Email type. Similarly, if the address being added is of Email type address while previously added addresses were of PIN type.
See Also:
Message.addRecipients(int, Address[])
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.0

addRecipients

public void addRecipients(int type,
                          Address[] addresses)
                   throws MessagingException
Adds recipient addresses.

Parameters:
type - Type of message recipient. Should be one of the following types: TO, CC, or BCC.
addresses - One or more recipient addresses to add.
Throws:
IllegalArgumentException - if any of the following conditions is true:
  • addresses contains a null element
  • the type parameter is not one of the following types: TO, CC, or BCC
MessagingException - if any of the following conditions is true:
  • if message recipient type is BCC but the IT Policy does not allow BCC
  • if addresses contains both PIN and Email type addresses
NullPointerException - if addresses == null
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getMessageType

public int getMessageType()
Returns the type of message

Returns:
The type of message is either Message.PIN_MESSAGE or Message.EMAIL_MESSAGE
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

getRecipients

public Address[] getRecipients(int type)
                        throws MessagingException
Retrieves all the recipient addresses for the message based on recipient type.

Parameters:
type - Type of message recipient (see Message.RecipientType interface; should be Message.RecipientType.TO, Message.RecipientType.CC, or Message.RecipientType.BCC.
Returns:
List of recipient addresses of provided type.
Throws:
MessagingException - To indicate a general messaging error.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setReplyTo

public void setReplyTo(Address[] addresses)
Sets the addresses to which replies should be directed.

This method adds addresses to this message's Message.RecipientType.REPLY_TO attribute.

Parameters:
addresses - One or more addresses.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getReplyTo

public Address[] getReplyTo()
                     throws MessagingException
Retrieves the addresses to which replies should be directed.

This method retrieves the addresses in this message's Message.RecipientType.REPLY_TO attribute.

Returns:
List of recipient addresses.
Throws:
MessagingException - To indicate a general messaging error.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setSubject

public void setSubject(String subject)
Sets the subject for this message. Subject string can have maximum length of 255 characters. Subject string longer than 255 characters will truncated when the message is sent.

Parameters:
subject - String to present in this message's subject line.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getSubject

public String getSubject()
Retrieves the subject of this message. Subject string longer than 255 characters will truncated when the message is sent.

Returns:
String appearing in this message's subject line.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setSentDate

public void setSentDate(Date date)
Sets the sent-date for this message.

Parameters:
date - Date when this message was sent.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getSentDate

public Date getSentDate()
Retrieves the sent-date for this message.

Returns:
Date on which this message was sent, or null if no sent-date is available for this message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getReceivedDate

public Date getReceivedDate()
Retrieves the received-date for this message.

Returns:
Date on which this message was received, or the creation date for an outbound message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setFlags

public void setFlags(int mask)
Sets flags for this message.

Parameters:
mask - Bitfield of flags to set for the message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

clearFlags

public void clearFlags(int mask)
Clears flags for this message.

Parameters:
mask - Bitfield of flags to clear.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getFlags

public int getFlags()
Retrieves the flags for this message.

Returns:
Bitfield of set flags.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setFlag

public void setFlag(int flag,
                    boolean set)
Sets or clears the specified flag on this message.

Parameters:
flag - Flag to set or clear for this message.
set - True to set the specified flag, false to clear the flag.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

isSet

public boolean isSet(int flag)
Determines if the specified flag is set on this message.

Parameters:
flag - Flag, as defined in Flag.
Returns:
True if the specified flag is set; otherwise, false.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getPriority

public byte getPriority()
Returns the priority of the Message.

Returns:
Priority as defined by the Message.Priority interface.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.7.0, 3.7

setPriority

public void setPriority(byte p)
Sets the priority of the message.

Parameters:
p - Priority to set (one of the Message.Priority interface values).
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.7.0, 3.7

isInbound

public boolean isInbound()
Determines if this message is an inbound (received) message.

Returns:
True if the message is an inbound (received) message; otherwise, false.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setInbound

public void setInbound(boolean b)
Sets the message status as an inbound (received) message.

Parameters:
b - True to set status as an inbount message
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

reply

public Message reply(boolean replyToAll)
              throws MessagingException
Retrieves a new message object suitable for a reply to this message.

Parameters:
replyToAll - True for reply to all; false for reply to sender only.
Returns:
New message object to send in reply to this message.
Throws:
MessagingException - To indicate a general messaging error.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

reply

public Message reply(boolean replyToAll,
                     boolean replyWithOriginalText)
              throws MessagingException
Retrieves a new message object suitable for a reply to this message.

Parameters:
replyToAll - True for reply to all; false for reply to sender only.
replyWithOriginalText - True to reply with the original text
Returns:
New message object to send in reply to this message.
Throws:
MessagingException - To indicate a general messaging error.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.2

forward

public Message forward()
Creates a new message object suitable for forwarding this message.

This method uses the capability of the BlackBerry system to forward messages from the mail server.

Returns:
New message object appropriate for forwarding this message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

addHeader

public void addHeader(String header,
                      String value)
Adds a value to list of values for header by name.

Specified by:
addHeader in interface Part
Parameters:
header - Name of header to which to add a value.
value - Value to add to named header.
Throws:
IllegalArgumentException - if attempting to add the MESSAGE_ID header
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setHeader

public void setHeader(String header,
                      String value)
Sets a value for header by name.

This will overwrite any existing headers matching the specified header name:

Specified by:
setHeader in interface Part
Parameters:
header - Name of header to which to add a value.
value - Value to add to named header.
Throws:
IllegalArgumentException - if attempting to set the MESSAGE_ID header
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

removeHeader

public void removeHeader(String header)
Removes all headers by name.

Note: This method behaves differently depending on the type of header that is being removed. Subject headers are set to null, rather than removed completely from the array. The most noticeable effect of this is that Message.getHeader(String) retrieves an array of strings that have inconsistent lengths.

Specified by:
removeHeader in interface Part
Parameters:
header - Name of the header fields to remove.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getHeader

public String[] getHeader(String header)
Retrieves all headers by name.

For the DATE header, returns both the received data (index 0) and the sent date (index 1) if applicable. That is, for an inbound message, the received date is the date the device received the message whereas the sent date is the date the sender sent the message.

Specified by:
getHeader in interface Part
Parameters:
header - Name of the header for which to retrieve the header data.
Returns:
Array of strings containing the various parts of the header data.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getAllHeaders

public Enumeration getAllHeaders()
Retrieves all the headers from this part as an enumeration of Header objects.

the DATE header will always occur twice, the first entry is always the date RECEIVED (by the handheld) the second is the date SENT (by the originating machine).

A new message created on the device will contain at least one header: the RECEIVED date.

Specified by:
getAllHeaders in interface Part
Returns:
Enumeration containing all headers of this part.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setContent

public void setContent(Object content)
                throws MessagingException
Sets the contents (body) for this message.

Content can be either a String or a Multipart object.

Specified by:
setContent in interface Part
Parameters:
content - Object to server as entire content for this message (any existing body parts are replaced); if null, this method clears this message of all its parts.
Throws:
MessagingException - If an error occurs while creating the message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getContent

public Object getContent()
Retrieves this message's body content.

Specified by:
getContent in interface Part
Returns:
An object containing this message's body content: this is typically a BodyPart object for a text message; for message that includes attachments, a Multipart object is returned.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getBodyText

public String getBodyText()
Retrieves the body text for this message.

Returns:
Body text for this message, or null if no body text in this message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getContentType

public String getContentType()
Retrieves this message's content-type.

Specified by:
getContentType in interface Part
Returns:
MIME content-type for this message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

isMimeType

public boolean isMimeType(String mimeType)
Determines if this message's content-type matches provided type.

Note: This method compares only the primary-type and sub-type in the content handler.

Specified by:
isMimeType in interface Part
Parameters:
mimeType - MIME type to which to compare the message; for example, "text/plain".
Returns:
True if the message has the specified MIME type; otherwise, false.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getInputStream

public InputStream getInputStream()
Retrieves an input stream for this message's contents.

Specified by:
getInputStream in interface Part
Returns:
Input stream for the TextBodyPart of the message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

writeTo

public void writeTo(OutputStream os)
             throws IOException
Writes this message out as an RFC 822 format stream.

Specified by:
writeTo in interface Part
Parameters:
os - Output stream to which to write the message text.
Throws:
IOException - If an error occurs when writing to the outputstream.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getSize

public int getSize()
Retrieves the size for this message's content.

Specified by:
getSize in interface Part
Returns:
Size of the contents of the message in bytes, or -1 if it cannot be determined.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

setStatus

public void setStatus(int messageStatus,
                      int messageTransmissionError)
Sets the status for this message.

If the message status is Message.Status.TX_ERROR (a transmission error), then the transmission error code in the model will be set to the value of your provided transmission error value. If message status is not Message.Status.TX_ERROR, then the transmission error code in the model will be cleared.

Parameters:
messageStatus - New status for this message.
messageTransmissionError - Transmission error status code to set if the message status is Message.Status.TX_ERROR.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getStatus

public int getStatus()
Retrieves the status of this message.

Returns:
Current message status: one of the TX_* or RX_* constants defined in Message.Status.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getTransmissionError

public int getTransmissionError()
Retrieves the transmission error code for this message.

The transmission error will be 0 unless the message status (returned by Message.getStatus()) is Message.Status.TX_ERROR.

Returns:
Current transmission error code.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

addMessageListener

public void addMessageListener(MessageListener listener)
Adds a message listener to this message.

Invoke this method only after invoking Folder.appendMessage(net.rim.blackberry.api.mail.Message) or Transport.send(net.rim.blackberry.api.mail.Message).

Parameters:
listener - Message listener to add to this message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

removeMessageListener

public void removeMessageListener(MessageListener listener)
Removes a message listener from this message.

Note: You should invoke this method only on the message on which Message.addMessageListener(net.rim.blackberry.api.mail.event.MessageListener) was invoked.

Parameters:
listener - Message listener to remove from this message.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

equals

public boolean equals(Object o)
Determines if two object instances are the same.

Many Message objects can refer to the same message ultimately. Therefore, use this method to determine if two Message instances are identical.

Overrides:
equals in class Object
Parameters:
o - Object to compare with this object.
Returns:
True if the two objects are identical; otherwise, false.
See Also:
Boolean.hashCode(), Hashtable
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

hashCode

public int hashCode()
Retrieves a hash code value for this message.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

updateUi

public void updateUi()
Initiates any necessary UI updates.

For instnce, if the message is currently open in the message list, this method will cause that view to get updated and hence render any programmatic changes.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

getMessageId

public int getMessageId()
Retrieves the integer ID of this message.

This is a convenience method to retrieve the ID of this message; the message ID is assigned when the message is added to a Folder, or when a message is sent.

Returns:
ID for this message.
See Also:
Folder.getMessages()
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.