This post will show you the structure of BlackBerry emails.
1. API: Mulipart->BodyPart
First, let's take a look at the Email API under net.rim.blackberry.api.mail.Multipart and et.rim.blackberry.api.mail.BodyPart
These two classes provide the components which consist the emails. An email is a multipart containing multiple bodyparts. It is a tree structure. Each bodypart can contain multipart as well. Therefore if you want to retrieve the information of an email, you need to do it recursively. See reference [1].
The key subclasses of BodyPart are TextBodyPart, MimeBodyPart and SupportedAttachmentBodyPart. The not so convenient part is that the method of "setContentType(String value)" in Class BodyPart is currently not supported, which means although the 3rd party apps can add bodypart to an email, it cannot sign the specific type to a bodypart (for example, 'text/html' content-type), which constraints the 3rd party apps abilities to control the emails.
[TextBodyPart]
BodyPart with 'text/plain' content-type. This class is used when creating a multipart message that includes a text/plain part.
[MimeBodyPart]
This Class represents a MIME body part.
MIME Definition:
The basic Internet e-mail transmission protocol, SMTP, supports only 7-bit ASCII characters. This effectively limits Internet email to messages which, when transmitted, include only the characters used for the English language. MIME defines mechanisms for sending other kinds of information in e-mail, including text in languages other than English using character encodings other than ASCII as well as 8-bit binary content such as files containing images, sounds, movies, and computer programs.
[SupportedAttachmentBodyPart]
Represents an attachment part that has a corresponding viewer on the handheld, including registered third-party viewers.
2. Relation with Class net.rim.blackberry.api.mail.Message
In Class Message, there is a method setContent(Object o). Object o can only be String or Multipart. Therefore, the connection between Message and Multipart is: Message.setContent(Multipart).
3. Notes:
(1). MimeBodyPart does not support signing any content (Method: setContent(Object o)). Therefore, to construct emails, TextBodyPart and SupportedAttachmentBodyPart should be used.
(2). UnsupportedAttachmentBodyPart is not publicly instantiatable.
3. References:
(1). Retrieve Email Information:
http://rim.lithium.com/t5/Java-Development/Access-HTML-email-messages/ta-p/444941
(2). Attach HTML File to Emails:
http://supportforums.blackberry.com/t5/Java-Development/Create-an-attachment/ta-p/445025
No comments:
Post a Comment