Reputation: 4935
I have a Java program which generates a PDF file. I want the user to click a button to open the default email client ready to send the PDF as an attachment. The two standard ways of opening the default email client have problems:
Can anyone suggest a way to do this?
Thanks
Upvotes: 2
Views: 2566
Reputation: 2974
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.
(I posted this answer to another question too.)
Upvotes: 2
Reputation: 112404
Did javax.mail.internet.MimeMultipart go away? That's sort of the canonical way to set up an attachment.
Okay, so if I've got this straight, you want to know how to let your application use an unspecified email client on an unspecified operating system to send a multipart MIME email containing an undefined attachment but not by constructing the MIME message yourself?
... well, okay, I guess you mentioned Outlook so it must be Windows. But still.
Upvotes: 1
Reputation: 22497
Is there a specific reason you'd like to use the default e-mail client, rather than sent it from Java using the e-mail client (JavaMail)?
Can you provide more details as to the kind of application you're trying to write? I take it this is a client GUI application (Swing/SWT/AWT), but beyond that, I think we're going to need more details.
Upvotes: 0