to softsailor: 发图片要用: MimeBodyPart mbp1 = new MimeBodyPart(); mbp1.setText(message); MimeBodyPart mbp2 = new MimeBodyPart(); FileDataSource fds = new FileDataSource(imgfile); mbp2.setDataHandler(new DataHandler(fds)); mbp2.setFileName(fds.getName()); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); mp.addBodyPart(mbp2); mp.addBodyPart(mbp1); msg.setContent(mp); Transport.send(msg) 我的email: yusiheng◎21cn.com 多交流。
另外我想请为,您是否知道如何发送图片信息
发图片要用:
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(message);
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource(imgfile);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
// create the Multipart and its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp2);
mp.addBodyPart(mbp1);
msg.setContent(mp);
Transport.send(msg)
我的email: yusiheng◎21cn.com 多交流。
subject=new String(Subject.getBytes("GB2312"),"ISO8859_1");
再发送