Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

PDF mail attachment send with spring-boot is empty

$
0
0

I have set up a MimeMessageHelper object to send email with attachment. My problem is when try to add a PDF attachment to the mail. The file is empty when received. There is no problem with other file format like TXT, and the content of the mail is also valid.

My code (I skip the config of the MimeMessageHelper since it seems to work):

MimeMessageHelper message = new MimeMessageHelper(...);
// ....

ClassPathResource resource = new ClassPathResource("mypdf.pdf");
File file = resource.getFile(); 

message.addAttachment(file.getName(), file);


How can I resolve this issue?


Viewing all articles
Browse latest Browse all 29748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>