Apache camel mailing - mail body showing all camel message header data

58 Views Asked by At

I have used the mailing code below. It was working fine earlier, but after upgrading it to Java version 17, other data from the camel exchange is also showing along with the mail body data.

    from("jms:queue:REPORT_MAIL").routeId("MAIL_ROUTE")
            .setHeader("To", simple("{{mail.to}}")).setHeader("From", simple("{{mail.from}}"))
            .setHeader("Subject", simple(" REPORT " + "-" + "${header.CURRENT_TIME}"))
            .process(new Processor() {
                @Override
                public void process(Exchange exchange) throws Exception {

                    exchange.getIn().setHeader("Content-Type", "text/plain");
                    String body = "\nPlease find the  load report at :\n " + filePath + "/"
                            + exchange.getIn().getHeader(CAMEL_FILENAME);
                    exchange.getIn().setBody(body);
                }
            }).to("{{mail.smtp.url}}").log("Mail Send succesfully");

I am only expecting the text content that I added in the email body, but also receiving unreadable characters. It appears that all camel exchange data is being displayed. Why is this so? How to remove those additional info.?

0

There are 0 best solutions below