0

I am trying to open the default mail box with the pdf attachment, using my jsp button with the following script in jsp

<a href="mailto:webmaster@example.com?subject=my report&body=see attachment&attachment="${pageContext.request.contextPath}/report_generate_pdf_ajax_call" class="navLink"><span>Email </span></a>

But it is able to open the default mail box with blank email, but not able to get the attachemnt from the url: ${pageContext.request.contextPath}/report_generate_pdf_ajax_call

I took the help of following link Link1 and Link2Link3 but I haven't got success with my result.

Any help regarding in this context will be appriciated.

SaviNuclear
  • 886
  • 1
  • 7
  • 19

1 Answers1

0

No, you can not add an attachment to a message with the mailto. mailto: only supports header values or text/plain content.

There is no provision for it in the mailto: protocol, and it would be a gaping security hole if it were possible. The best idea to send a file is:

  1. Have the user to choose a file
  2. Upload the file to a server and the server return a random file name after upload
  3. Build a mailto: link that contains the URL to the uploaded file to the server in the message body

So probably you can use apache commons for this but there will be a place on the server where all the user files will be located that will require cleaning from time to time somehow.

For more info kindly see here

Shailesh Saxena
  • 3,472
  • 2
  • 18
  • 28