2

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:

  1. Java 6 doesn't seem to allow for attachments in the generated message
  2. JDIC has a bug which prevents Outlook 2007 from sending the message correctly: http://jdic.dev.java.net/issues/show_bug.cgi?id=160

Can anyone suggest a way to do this?

Thanks

Michael Myers
  • 188,989
  • 46
  • 291
  • 292
Mark
  • 4,749
  • 7
  • 44
  • 53

3 Answers3

2

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.)

Community
  • 1
  • 1
Brian de Alwis
  • 2,814
  • 2
  • 18
  • 32
1

Did javax.mail.internet.MimeMultipart go away? That's sort of the canonical way to set up an attachment.

Update

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.

Community
  • 1
  • 1
Charlie Martin
  • 110,348
  • 25
  • 193
  • 263
  • This is a SWT desktop application so the user will likely have an email client on the desktop and will not want to configure my app for sending emails. – Mark Apr 11 '09 at 06:07
0

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.

Jack Leow
  • 21,945
  • 4
  • 50
  • 55
  • I'd say that the app can export a file over email, and the user would like to use his favorite email client to do that. – Benoit Duffez Jul 16 '14 at 06:51