Search code examples
javamailto

How to open an email client and automatically attach file in java


Possible Duplicate:
Java: Start Mail-Client with Attachment?

I need to create a java code that will open an email client (Outlook, outlook express , etc) and automatically attach a file in it. I tried using mailto but it only opens the mail client and do not attach the file. Help please.

thanks a lot.


Solution

  • JDIC provides some functionality to do this. Although much of JDIC was absorbed into java.awt.Desktop in Java 6, it didn't include the email composition bits. Unfortunately the JDIC binaries disappeared with the transition of java.net to the Kenai platform; I uploaded the most recent versions I could find to the project JIRA.

    JDIC doesn't play well in OSGi, so I recently extracted the relevant MAPI bits into a bundle called jmapi.