Hello,
I am trying to follow the example here to send an email with an attachment with Fuse.
There is a "HELLO.TXT" in the fuse directory.
http://camel.apache.org/mail.html
----
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import org.apache.camel.CamelContext;
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
public class sendEmail implements Processor {
public void process(Exchange exchange) throws Exception {
CamelContext context = exchange.getContext();
Endpoint endpoint = context.getEndpoint("..."); // my smtp connection string here
Message in = exchange.getIn();
in.setBody("Hello World");
in.addAttachment("HELLO.TXT", new DataHandler(new FileDataSource("HELLO.TXT")));
Producer producer = endpoint.createProducer();
producer.start();
producer.process(exchange);
}
}
I can send the email fine (with my own smtp server), but attachment fails with the following runtime error in the log:
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed;
boundary="----=_Part_0_1855735248.1342812983558"]
org.apache.camel.RuntimeCamelException: javax.mail.MessagingException: IOException while sending message;
...
What does DCH mean? What does this exception mean?
Is there a work around?
Thanks,
Alex