<p>I'd like to encourage our users of our RCP application to send the problem details to our support department. To this end, I've added a "Contact support" widget to our standard error dialogue.</p>

<p>I've managed to use URI headers to send a stacktrace using Java 6's JDIC call: <a href="http://java.sun.com/javase/6/docs/api/java/net/URI.html" rel="nofollow noreferrer"><code>Desktop.getDesktop().mail(java.net.URI)</code></a>. This will fire up the user's mail client, ready for them to add their comments, and hit send. </p>

<p>I like firing up the email client, because it's what the user is used to, it tells support a whole lot about the user (sigs, contact details etc) and I don't really want <a href="http://www.catb.org/~esr/jargon/html/Z/Zawinskis-Law.html" rel="nofollow noreferrer">to ship with Java Mail</a>.</p>

<p>What I'd like to do is attach the log file and the stacktrace as a file, so there is no maximum length requirement, and the user sees a nice clean looking email, and the support department has a lot more information to work with.</p>

<p>Can I do this with the approach I'm taking? Or is there a better way?</p>

<p><strong>Edit</strong>: 
I'm in an OSGi context, so bundling JDIC would be necessary. If possible, I'd like to ship with as few dependencies as possible, and bundling up the JDIC for multiple platforms does not sound fun, especially for such a small feature.</p>

<p>JavaMail may be suitable, but for the fact that this will be on desktops of our corporate clients. The <strong>setup/discovery of configuration</strong> would have to be transparent, automatic and reliable. Regarding JavaMail, configuration seems to be manual only. Is this the case?</p>

<p>The answer I like most is using the <code>Desktop.open()</code> for an *.eml file. Unfortunately <strong>Outlook Express (rather than Outlook) opens eml files</strong>. I have no idea if this is usual or default to have Windows configured for to open EML files like this. Is this usual? Or is there another text based format that a) is easy to generate, b) opens by default in the same email client as users would be using already?</p>

[{'answer_id': 81882, 'author': 'tim_yates', 'author_id': 6509, 'author_profile': 'https://Stackoverflow.com/users/6509', 'pm_score': 0, 'selected': False, 'text': '<p>Using that method, you can set the subject line and body text with a URI like</p>\n\n<pre><code>mailto:me@here.com?SUBJECT=Support mail&amp;BODY=This is a support mail\n</code></pre>\n\n<p>However, the length of the subject and body text will <a href="http://forums.java.net/jive/thread.jspa?messageID=204302&amp;tstart=0" rel="nofollow noreferrer">have some limitation</a></p>\n\n<p>There is no way I can think of to attatch a file using this method or something similar (without adding javamail to your app)</p>\n'}, {'answer_id': 81988, 'author': 'Stephen Denne', 'author_id': 11721, 'author_profile': 'https://Stackoverflow.com/users/11721', 'pm_score': 3, 'selected': True, 'text': '<p>You could save a temporary .eml file, and Desktop.getDesktop().open(emlFile)<br>\n<strong>Edit:</strong> As you point out, this will unfortunately open outlook express instead of outlook.<br>\nHowever if you have Windows Live Mail installed, it will use that.</p>\n'}, {'answer_id': 82337, 'author': 'entzik', 'author_id': 12297, 'author_profile': 'https://Stackoverflow.com/users/12297', 'pm_score': 0, 'selected': False, 'text': '<p>JDIC may not always be available on your user\'s platform. A good way to do this is to use the javamail API. You can send a multi-part e-mail message as explained in this tutorial by SUN:</p>\n\n<p><a href="http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#SendingAttachments" rel="nofollow noreferrer">Sending Attachments</a></p>\n'}, {'answer_id': 83815, 'author': 'Asgeir S. Nilsen', 'author_id': 16023, 'author_profile': 'https://Stackoverflow.com/users/16023', 'pm_score': 1, 'selected': False, 'text': '<p>If you\'re using JDK 6 (you really should), the Desktop API is now part of the JRE.  See <a href="http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/" rel="nofollow noreferrer">http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/desktop_api/</a> for more information.</p>\n'}, {'answer_id': 86176, 'author': 'user11915', 'author_id': 11915, 'author_profile': 'https://Stackoverflow.com/users/11915', 'pm_score': 1, 'selected': False, 'text': "<p>As a completely different way of handling the same problem, we use a bug tracker with an XML-RPC interface, and our (RCP also, btw) app talks to that using a custom submission dialogue.  It means we can send the log files to help diagnose the problem, without the user having to find them.  </p>\n\n<p>I'm sure most bug trackers have something like this available.  We use Jira, and it works great (apparently, they've just released a free Personal version that makes it easy to try).</p>\n"}, {'answer_id': 4014528, 'author': 'Joeky', 'author_id': 486406, 'author_profile': 'https://Stackoverflow.com/users/486406', 'pm_score': 0, 'selected': False, 'text': '<pre><code>import java.awt.Desktop;\nimport java.io.File;\nimport java.net.URI;\n\n\npublic class TestMail {\n\n    public static void main(String[] args) {\n        try {       \n         Runtime.getRuntime().exec(\n                  new String[] {"rundll32", "url.dll,FileProtocolHandler",\n                        "mailto:a@a.de?subject=someSubject&amp;cc=a@a.de&amp;bcc=a@a.de&amp;body=someBodyText&amp;Attach=c:\\\\test\\\\test.doc"}, null\n                  );\n\n\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/81862', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4737/']