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
Developer
ashishjmeshram
Posts: 154
Registered: ‎01-08-2010
My Device: 8310 Rogers

How to read text attachment from email in FolderListener?

Hi

 

 

We have a folderlistener in our blackberry application.

 

The emails arriving at the blackberry will sometimes have an attachment of type .txt.

 

How do I read the email body content and attachment content separately?

 

I can read the content but it gives me email body content and attachment content together. I can not differentiate between the two.

 

Here's my code.

 

 

if (orginalMessage.getContent() instanceof TextBodyPart) {
	TextBodyPart multi = (TextBodyPart) orginalMessage.getContent();
	Object content = multi.getContent();
	System.out.println("content " + content);
}

 

 

I would want something like this

 

String emailBody ="";

 

String textAttachmentContent ="";

 

 

Thanks 

Please use plain text.
Developer
ashishjmeshram
Posts: 154
Registered: ‎01-08-2010
My Device: 8310 Rogers

Re: How to read text attachment from email in FolderListener?

Hi

 

When I read email content with attachment i get a String which consist of both email body and email attachment. 

 

Attachment is file with .txt extension.

 

e.g. If My email body is "Some sample test message" and attachment.txt has some content like 'attachment content', then below line

 

 

Object content = multi.getContent();

 

gives "Some sample test message attachment content".

 

How do I differentiate between  email body and attachment content.

 

Please help.

 

 

Thanks

 

Please use plain text.
Developer
ashishjmeshram
Posts: 154
Registered: ‎01-08-2010
My Device: 8310 Rogers

Re: How to read text attachment from email in FolderListener?

Is there any way I can seprately pull out the email body and attachment content?

Please use plain text.