日期:2014-05-20 浏览次数:20840 次
message.setText("this just for test"); message.setSubject("For test"); Multipart m = new MimeMultipart(); BodyPart body = new MimeBodyPart(); DataSource source = new FileDataSource(new File("E:\\path.txt")); body.setDataHandler(new DataHandler(source)); m.addBodyPart(body); message.setContent(m, "file"); message.setSentDate(new Date()); Transport.send(message);