<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.theeggeadventure.com/wikimedia/index.php?action=history&amp;feed=atom&amp;title=JavaMailFun</id>
	<title>JavaMailFun - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.theeggeadventure.com/wikimedia/index.php?action=history&amp;feed=atom&amp;title=JavaMailFun"/>
	<link rel="alternate" type="text/html" href="https://www.theeggeadventure.com/wikimedia/index.php?title=JavaMailFun&amp;action=history"/>
	<updated>2026-06-06T09:07:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0-beta</generator>
	<entry>
		<id>https://www.theeggeadventure.com/wikimedia/index.php?title=JavaMailFun&amp;diff=1599&amp;oldid=prev</id>
		<title>Brianegge at 01:37, 4 June 2007</title>
		<link rel="alternate" type="text/html" href="https://www.theeggeadventure.com/wikimedia/index.php?title=JavaMailFun&amp;diff=1599&amp;oldid=prev"/>
		<updated>2007-06-04T01:37:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;What could be simplier than sending an email from a command line app in Java?  Well, a lot of things.  I have an app which works fine in the IDE but fails via the command line with this exception:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
javax.mail.MessagingException: IOException while sending message;&lt;br /&gt;
  nested exception is:&lt;br /&gt;
        javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=us-ascii&lt;br /&gt;
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:625)&lt;br /&gt;
        at javax.mail.Transport.send0(Transport.java:169)&lt;br /&gt;
        at javax.mail.Transport.send(Transport.java:98)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A quick Google search indicates that this is fairly common.  In my case, the command line app runs via [[http://one-jar.sourceforge.net/ OneJar]], though most people have their fun when deploying to their app server.  The first thing I tried was downloading &amp;#039;&amp;#039;&amp;#039;activation.jar&amp;#039;&amp;#039;&amp;#039;.  I noticed in the IDE I have four different versions of the &amp;#039;&amp;#039;&amp;#039;UnsupportedDataTypeException&amp;#039;&amp;#039;&amp;#039; class.  One comes from log4j, two from weblogic, and one from Jetty.  I hoped adding a fifth via activation.jar would solve things.  Well, no such luck.&lt;br /&gt;
&lt;br /&gt;
Fortunately, I found one person&amp;#039;s solution on [[http://www.jguru.com/faq/view.jsp?EID=237257 JGuru]].  Austin Prichard-Levy suggests adding this to your mail script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();&lt;br /&gt;
        mc.addMailcap(&amp;quot;text/html;; x-java-content-handler=com.sun.mail.handlers.text_html&amp;quot;);&lt;br /&gt;
        mc.addMailcap(&amp;quot;text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml&amp;quot;);&lt;br /&gt;
        mc.addMailcap(&amp;quot;text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain&amp;quot;);&lt;br /&gt;
        mc.addMailcap(&amp;quot;multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed&amp;quot;);&lt;br /&gt;
        mc.addMailcap(&amp;quot;message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822&amp;quot;);&lt;br /&gt;
        CommandMap.setDefaultCommandMap(mc);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I did that, and my app started sending mail.  I don&amp;#039;t know how or why.&lt;/div&gt;</summary>
		<author><name>Brianegge</name></author>
	</entry>
</feed>