1

I need find solution about my problem. I need to generate email with address, subject, body and attachment and open this in local email client Outlook/Thunderbird etc. I tried this methods:

AWT.Desktop

Desktop desktop = Desktop.getDesktop();       
String message = "mailto:username@domain.com?subject=New_Profile&body=seeAttachment&attachment=c:/Update8.txt";
URI uri = URI.create(message);
desktop.mail(uri);

ProccessBuilder in cmd I was using mailTo

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
Patryk S
  • 33
  • 3
  • Most mail clients likely won't support it for security reasons, see also https://stackoverflow.com/q/5233556. If you are only trying to support a specific mail client you could start the executable manually (see [this answer](https://stackoverflow.com/a/37031351)) though that is error-prone. Another solution is to write the mail as `.eml` file and then have the mail client open it (see [this answer](https://stackoverflow.com/a/28548794)). However, not every mail client might support this and you would have to delete the file somehow again. – Marcono1234 Sep 04 '20 at 10:38
  • I know about security issues. Thank you for your answer. I will try this method. – Patryk S Sep 04 '20 at 20:52

0 Answers0