Nidhi Bhatnagar

Greenhorn
+ Follow
since Mar 24, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Nidhi Bhatnagar

Hi,
I am using a byte array to send it as an attachment for reading Excel files. It works fine for a few files and for other even smaller files it does not show any error but does not send it either.
Any clues?
The code I am using is:
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(messageBody.toString(),"text/html");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
if( attachments != null) {
MimeBodyPart bodyPart = new MimeBodyPart();
DataSource ds = new ByteArrayDataSource(attachments, contentType,filename);
bodyPart.setDataHandler( new DataHandler(ds));
bodyPart.setDisposition( "attachment; filename=\"" + filename + "\"");
bodyPart.setFileName("zip_code.xls");
multipart.addBodyPart(bodyPart);
}
msg.setContent(multipart);
Transport.send(msg);
Any help is appreciated.
Thanks
Nidhi
14 years ago