02-08-2010 01:26 PM
Hi,
I want to make an attachment to the email before it's sent out, so I apply following in SendListener.sendMessage method. But the email can't be sent out. In my sent folder, the email was marked by a red "X".
Can someone let me know what's the problem (I traced and my original email has normal bodypart content)?
thanks,
Mike
codes in SendListener.sendMessage:
//for normal bodypart content
if (content instanceof BodyPart) {
TextBodyPart part = (TextBodyPart)content;
if ( part.hasMore() && (!part.moreRequestSent()) ) {
System.out.println("get data from server for single body part");
Transport.more(part, true);
while (part.hasMore()) {
try {
System.out.println("wait for the message...");
Thread.sleep(1000); //sleep 1 sec
} catch (Throwable e) {
e.printStackTrace();
}
}
}
bodyText = (String)part.getContent();
Multipart multipart = new Multipart(); // Default type of multipart/mixed.
TextBodyPart tbp = new TextBodyPart(multipart, bodyText);
SupportedAttachmentPart attach = new SupportedAttachmentPart( multipart, "text/plain", "data.txt", "abc");
//multipart.addBodyPart((BodyPart)content);
//System.out.println("add old content to the new multipart");
multipart.addBodyPart(tbp);
multipart.addBodyPart(attach); // Add the attachment to the multipart.
msg.setContent(multipart);
System.out.println("reset the content to the new multipart");
}
02-09-2010 04:53 PM
What BlackBerry Smartphone model and BlackBerry device software version are you testing on? You can find this under Options, About on the BlackBerry Smartphone.