This week's book giveaway is in the Java in General forum.
We're giving away four copies of Java by Comparison (eBook) and have Simon Harrer, Jörg Lenhard, Linus Dietz on-line!
See this thread for details.
Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

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
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

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
15 years ago