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
New Developer
Posts: 4
Registered: ‎09-15-2008
My Device: Not Specified

Sending email with attachement problem on bold

I have some code that is working on an 8703e blackberry but is causing a "Transaction Failure - General Error" on the bold.  The email gets placed into the "Not sent" folder and can then be manually sent without an issue. 

 

This is the code I am using to send the email.   Variable "S" is just xml data in string format.

 

        String fileName = "Survey_"+DeviceInfo.getDeviceId()+"_"+dateStr+".xml";
 

        //create the file
        SupportedAttachmentPart sap = new SupportedAttachmentPart(mp,"text/html",fileName, s.getBytes());
   
        TextBodyPart tbp = new TextBodyPart(mp,messageData);
   
        //add the file to the multipart
        mp.addBodyPart(tbp);
        mp.addBodyPart(sap);
   
        //create a message in the sent items folder6
        Folder folders[] = Session.getDefaultInstance().getStore().list(Folder.SENT);
   
        Message message = new Message(folders[0]);
   
        //add recipients to the message and send
        try {

           Address toAdds[] = new Address[1];
           Address toAdd = new Address("test@email.com","Joe Smith");
           toAdds[0] = toAdd;
           

            message.addRecipients(Message.RecipientType.TO,toAdds);
            message.setContent(mp);
   
            Transport.send(message);
        } catch (Exception e) {
            Dialog.inform(e.toString());
        }

 

 

Thanks for the help!

New Developer
Posts: 4
Registered: ‎09-15-2008
My Device: Not Specified

Re: Sending email with attachement problem on bold

I have tried it on another bold and it looks like the Attachment is not being created correctly.  This code works fine in os 4.1

 

Any ideas?

 

Thanks

BlackBerry Development Advisor
Posts: 15,089
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Sending email with attachement problem on bold

Are you testing with a mail account that uses a BlackBerry Enterprise Server or the BlackBerry Internet Service?  If it is the former, what is the version of your server?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 4
Registered: ‎09-15-2008
My Device: Not Specified

Re: Sending email with attachement problem on bold

We are running BES 4.1.3
BlackBerry Development Advisor
Posts: 15,089
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Sending email with attachement problem on bold

What is the default message service set to on the BlackBerry Bold?  Is it set to Desktop or something else?  You can veiw this under Options, Advanced Options, Default Services.

 

Are you able to send an email with attachments outside of your application?  For example, take a picture and email it?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 4
Registered: ‎09-15-2008
My Device: Not Specified

Re: Sending email with attachement problem on bold

The problem was the attachment had an .xml extension.  I changed it to txt and it works fine now.

 

Thanks for the help!