I'm trying to send an e-mail with a subject, body and attached file. The
subject and attached file works fine. However when I make an attachment, the
body of the email ends up as an unnamed attachment in the final mail.

Is this a bug in Camel or do I need to do something to make sure the
Camel-body becomes a "bodyPart" and not an attachment?

Example route:

from("direct:sendReportEmailRoute")
        .routeId("sendReportEmailRoute")
        .setProperty("originalBody", body())
        .process(new Processor() {

                @Override
                public void process(Exchange exchange) throws Exception {
                        Message in = exchange.getIn();
                        FileDataSource file = new
javax.activation.FileDataSource("H:\\file.txt");
                        in.addAttachment("report.txt", new DataHandler(file));
                        in.setBody("Hello");
                }
                
        })

.to("smtp:xxx?to=x...@xxx.com,andreasasm...@gmail.com&from=nore...@xxx.dk&subject=Your
report")
        .setBody(simple("${property.originalBody}"));



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-Body-ends-up-as-attachment-instead-of-e-mail-body-in-multipart-mail-tp5789939.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to