Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
bb_mamz
Posts: 14
Registered: ‎12-08-2011
My Device: developer

How to get all the details (suject,sender,sent date etc) related to email when reading the email body

Hi,

 

I am working on an application which reads the email body and attachments and uploads to server. As part of this I am able to read the email body (with complete HTML formatting of the email body) and attachments . I am using the below code to get the content of the email body.

 

  InputStream mbpStream = mimebodypart.getInputStream();            
  int ch = mbpStream.read();               
   while(ch!=-1)
            {
                 reqVector.addElement((byte) (ch));                                       
                 ch = mbpStream.read();
            }

 

With the above code I am able to retrieve the email body content only and not the subject,from address, to address,sent date etc details.

 

How to get all the details as part of email body (similar to the email print which we do on browser on desktop)

 

Thanks in advance,

Mamatha

 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to get all the details (suject,sender,sent date etc) related to email when reading the email body

subject, from, to etc are not part of the body.

you can use http://www.blackberry.com/developers/docs/7.1.0api/net/rim/blackberry/api/mail/Message.html#getFrom(... and the related methods to retrieve this information.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Contributor
bb_mamz
Posts: 14
Registered: ‎12-08-2011
My Device: developer

Re: How to get all the details (suject,sender,sent date etc) related to email when reading the email body

Yes to get the subject sender and other details there are separate methods available in Message class. So it is not possbile to get these details as part of body?

 

My requirement is to print the email body and attachments. But when I am printing the email body only the email body content id getting printed which is not similar to the email print which we do from our desktop browser.

 

Are there any idea/solutions to achieve this??

 

Is it possbile to combine the the details with the body content ( retaining the email formatting)

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to get all the details (suject,sender,sent date etc) related to email when reading the email body

you have to format it yourself
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter