Hi Mattias,
You can specify the charset of Mail message by setting this header.
headers.put(Exchange.CONTENT_TYPE, "text/plain; charset=ISO-8859-1");
I just did some test with latest camel trunk code with this change[1],
now Gmail is happy with the camel-mail message subject and body.
[1]https://issues.apache.org/activemq/browse/CAMEL-2870
Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang
Mattias Severson wrote:
I created a new route which I added to my camel context:
from("direct:send").setProperty(Exchange.CHARSET_NAME, new
ConstantExpression("ISO-8859-1")).to("smtp://myserver");
And then I updated the producer template:
producerTemplate.sendBodyAndHeaders("direct:send", body, camelEmailHeader);
The actual recipient address is specified in the camelEmailHeader.get("to")
The mail I send has the subject "Subject åäö ÅÄÖ" and the body "Body åäö
ÅÄÖ"
There are still some problems, depending on which email client I use.
Gmail:
The subject is displayed as "Subject: едц ЕДЦ"
The body is displayed correctly
Thunderbird:
In the email list, the subject is displayed as "Subject: ??? ???"
In the email itself, the subject displayed correctly
The body is displayed as "Body åäö ÅÄÖ"
Apple mail:
Both the subject and the body are displayed correctly