Send e-mail in Pdf attachment as stream

后端 未结 2 1163
日久生厌
日久生厌 2020-12-25 08:24

I want to send a Pdf as an e-mail attachment (I am using the JavaMail API ). I have the Pdf (generated by jasper) as an byte[].

public InputStre         


        
2条回答
  •  失恋的感觉
    2020-12-25 08:40

    The constructor you used is for parsing a mime part from the transport.

    Your second example should work out right. You may consider

    • not to convert to InputStream and back, this will make unnecessary copies
    • add a disposition ( e.g. bp.setDisposition(Part.ATTACHMENT); )

提交回复
热议问题