File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes HTML in Desktop.mail(URI)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "HTML in Desktop.mail(URI)?" Watch "HTML in Desktop.mail(URI)?" New topic

HTML in Desktop.mail(URI)?

Brian Batson

Joined: Jun 15, 2011
Posts: 11
Has anyone ever used the Desktop.mail(URI) method to generate an e-mail and successfully used HTML within the e-mail body?

I know this is possible using the JavaMail API, but I'm running into problems with that given my firm's implementation of heavy security around Microsoft Exchange.

Right now this is my simple code:

However, the body of the e-mail actually shows the HTML tags and does not format the text as intended. I feel like I'm missing something obvious. As a side note, I really wish attachments were possible using the Desktop.mail(URI) method.

Any guidance is appreciated very much.

Thank you,
Wim Vanni
Ranch Hand

Joined: Apr 06, 2011
Posts: 96

I notice that it is rather incomplete html you're writing there (no <body> tag for example). Not sure if that matters in this particular case.


Edit: StackOverflow lists an answer that in the mailto body you have to use plaintext.
I agree. Here's the link:
subject: HTML in Desktop.mail(URI)?
It's not a secret anymore!