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
Trusted Contributor
gopi
Posts: 126
Registered: ‎10-15-2010
My Device: Torch 9850
My Carrier: Not specified

Add Message in Email Attachment

Hi to All,
I have attached the vcf attachment in email, it's working fine, but the message content is not showing up, please help me.

Multipart multipart = new Multipart();
            String[] data_formats = PIM.getInstance().supportedSerialFormats(
                    PIM.CONTACT_LIST );
            ByteArrayOutputStream os = new ByteArrayOutputStream();
            PIM.getInstance().toSerialFormat( contact, os, "UTF-8", data_formats[ 0 ] );
            SupportedAttachmentPart attach = new SupportedAttachmentPart(multipart, "text/x-vcard", "contact1.vcf", os.toByteArray());
            multipart.addBodyPart(attach);
            
            Store store = Session.getDefaultInstance().getStore();
            Folder[] folders = store.list(Folder.SENT);
            Folder sentfolder = folders[0];
            Message message = new Message(sentfolder);
            message.setContent(multipart);
            message.setContent("Hai please add me in your contact");        
            message.setSubject("Add me");

            
Message conent:"Hai please add me in your contact" is not displayed in email.


I can only able to add vcf or message in setContent, But i need both attachment and message in  Email Content.

Please use plain text.
Trusted Contributor
gopi
Posts: 126
Registered: ‎10-15-2010
My Device: Torch 9850
My Carrier: Not specified

Re: Add Message in Email Attachment

Myself fixed the issue, Just the inputted the message content first and then attached the file it worked fine.

 message.setContent("Hai please add me in your contact"); 
 message.setContent(multipart);

 

Please use plain text.