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

JCJC错别字检测-田春峰
博客专家认证
2004-03-15 04:54:29
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
...全文
77 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

67,549

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧