hi, help me发送byte[]附件的问题

04-03-15 accesine
hi, help me发送byte[]附件的问题

the excpetion is :

------------------------------------------------------

javax.mail.SendFailedException: Sending failed;

nested exception is:

javax.mail.MessagingException: IOException while sending message;

nested exception is:

java.io.IOException: No content

at javax.mail.Transport.send0(Transport.java:219)

at javax.mail.Transport.send(Transport.java:81)

------------------------------------------------------

i retrive the attachment from the blob type filed in oracle db.

but when i send it , the above error occurs

below is my send code;

DataSource ds = new BufferedDataSource(b, filename);

bodyPart.setDataHandler( new DataHandler( new ByteArrayDataSource(b, "application/octet-stream",filename ) ) );

bodyPart.setFileName(filename);

multipart.addBodyPart(messageBodyPart);

-----------------------------------------------------

b is a byte array

any one can help me , thanks in advance

beijing,

china

猜你喜欢