0
try {
      Runtime.getRuntime().exec(
             new String[]
             {
                 "rundll32", 
                 "url.dll,FileProtocolHandler",
                 "mailto:a@a.de?subject=someSubject&cc=a@a.de&bcc=a@a.de&body=someBodyText&Attach=c:\\test\\test.doc"
              }, null
       );
} (IOException ri) {

}

I'm working on this code example which starts E-Mail client from Java application. I can successfully start the E-Mail client but I don't have any attachment. Any idea how I can fix this?

Jeroen Vannevel
  • 43,651
  • 22
  • 107
  • 170
Peter Penzov
  • 1,126
  • 134
  • 430
  • 808

1 Answers1

0

Starting the mail client by a mailto: link and passing the filename for an attachement is a high security risk and thus prohibited by the most MUA. Allowing such thing would mean that you are able to craft a URL which then will offer the user to actively send you any file from his harddisk. Absolutely a no-go.

You must integrate with the APIs offered by the underlying OS. You can not use mailto: links for a sophisticated task like this

Axel Amthor
  • 10,980
  • 1
  • 25
  • 44