Announcement Announcement Module
No announcement yet.
html jasperreports by email problem. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • html jasperreports by email problem.


    I need to send (by email) a report (in html) generated by JasperReports.

    JasperReports generates an xxx.html file with references to an xxx.html_files/px file.

    I use MimeMessageHelper.setText(xxx.html)

    Now my questions are:

    1. How do I include/embed the xxx/px data in the email as well? I looked at MimeMessageHelper.addInline(cid, ...) but the references in xxx.html to a xxx/px are not done with cid:.
    2.Is there a way to avoid the generation of these files xxx.html and xxx.html_files/px and directly send the generated report by email? With ModelAndView?

    I looked at the various docs but didn't find anything for me .

    Any help welcome,

    Thanks in advance,


  • #2

    There is no direct support in Spring for generating HTML reports for e-mail transmission. You really have two options when generating the mails: embed images or not.

    If you choose not to, you can have your HTML include absolute paths (starting with http://) to the images so they can still be rendered.

    If you do embed them, you need to parse the HTML after it is generated and transform the image URLs into cid: URLs. This can be done quite simply with a regular expression.



    • #3
      Thanks Rob,

      Now it works (I parsed the HTML and transformed the image URLs into cid: URLs).