- 58 名前:デフォルトの名無しさん [2008/08/12(火) 13:26:14 ]
- JavaMailで質問です。
プログラム内でPDFを作成して添付ファイルとして送りたいのですが、 作成したPDFをファイルシステムに保存したくありません。 今はこんな感じでやってます。 //PDFファイルを一時ファイルとして書き出し File tmpFile = File.createTempFile("foo", ".pdf"); //PDFをOutputStreamに書き出す独自クラス report.renderPDF(new FileOutputStream(tmpFile)); MimeBodyPart attachedPart = new MimeBodyPart(); attachedPart.setFileName("filename.pdf"); attachedPart.setDataHandler(new DataHandler(new FileDataSource(tmpFile))); File.createTempFile を使わずに添付ファイルを送るいい方法はありますか?
|

|