有些人請告訴我如何附上pdf file
到mail
。 我使用mail.jar
和activation.jar
發送mail
。 我可以發送mail
但我不知道如何發送pdf file
與附件。 所以請建議我關於 謝謝。如何在java中附加生成的pdf文件郵件
我只是嘗試
String filename = "file.pdf";
Multipart multipart1 = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
multipart1.addBodyPart(messageBodyPart);
但仍須沒有得到數據,這空連接。
要是你用Google搜索它,你甚至不需要問這個問題 – fge