[
https://issues.apache.org/activemq/browse/CAMEL-869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45863#action_45863
]
Adam commented on CAMEL-869:
----------------------------
Some feedback:
I took a look at tests for camel-mail.
Please see some snippets from our routeBuilder below:
from(direct:infectionAlert)
.to("xslt:" + infectionAlertXsl)
.setHeader("subject", constant("Test"))
.to("smtp://" + smtp_server + ":" +
port+"?From="+from+"&To="+recipients.toString());
from(direct:infectionAlert)
.to("xslt:" + infectionAlertXsl)
.setHeader("subject", "Test")
.to("smtp://" + smtp_server + ":" +
port+"?From="+from+"&To="+recipients.toString());
from(direct:infectionAlert)
.to("xslt:" + infectionAlertXsl)
.setHeader("Subject", constant("Test"))
.to("log:debug")
.to("smtp://" + smtp_server + ":" +
port+"?From="+from+"&To="+recipients.toString());
from(direct:infectionAlert)
.to("xslt:" + infectionAlertXsl)
.setHeader("Subject", "Test")
.to("log:debug")
.to("smtp://" + smtp_server + ":" +
port+"?From="+from+"&To="+recipients.toString());
None of the messages arrived with a subject. Some details of the environment we
use:
- java 1.5 +, spring 2.5.5,
- tried mail servers: MS Exchange, james
I tried other combinations too (following spec). None of them arrived with a
subject.
Looking forward to hearing from you (if more details needed, please let me know)
thanks
Adam
> A subject from message header is not copied to mailMessage
> -----------------------------------------------------------
>
> Key: CAMEL-869
> URL: https://issues.apache.org/activemq/browse/CAMEL-869
> Project: Apache Camel
> Issue Type: Bug
> Components: camel-mail
> Affects Versions: 1.4.0, 1.5.0
> Reporter: Adam
> Assignee: Hadrian Zbarcea
> Fix For: 1.5.0
>
>
> The issue refers to sending emails on one of the stages in the messaging
> pipeline. I checked all the suggested solutions from the spec and none of the
> them resulted in an email message with a subject.
> I have the following code:
> ...
> private static final String DIRECT_INFECTION_ALERT =
> "direct:infectionAlert"'
> ...
> from(DIRECT_INFECTION_ALERT)
> .to("xslt:" + infectionAlertXsl)
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception
> {
> Message m = exchange.getIn();
> Map<String,Object> headers = new HashMap<String, Object>();
>
> headers.put(TO_HEADER_KEY, recipients.toString());
> headers.put(FROM_HEADER_KEY, from);
> headers.put(SUBJECT_HEADER_KEY, constant(INFECTION_ALERT_SUBJECT));
>
> m.setHeaders(headers);
> m.setBody(exchange.getIn().getBody(), MailMessage.class);
> MailMessage mail = new MailMessage();
> mail.copyFrom(m);
> exchange.setIn(mail);
> }})
> .to("log:debug","smtp://" + smtp_server + ":" + port);
> and a simple and naive version ->
> from(DIRECT_INFECTION_ALERT)
> .to("xslt:" + infectionAlertXsl)
> .process(new Processor() {
> public void process(Exchange exchange) throws Exception
> {
> Message message = exchange.getIn();
> Map<String,Object> headers = new HashMap<String, Object>();
> headers.put(TO_HEADER_KEY, recipients.toString());
> headers.put(FROM_HEADER_KEY, from);
> headers.put(SUBJECT_HEADER_KEY, constant(INFECTION_ALERT_SUBJECT));
>
> message.setHeaders(headers);
> }})
> .to("log:debug","smtp://" + smtp_server + ":" + port);
> I tried many other combinations, well all from the camel mail component spec.
> Upgraded camel to 1.5-SNAPSHOT (comes with fix for disabling authentication
> on missing username/password for mail server). I can receive email messages,
> no problem, but never managed to get one with a subject. On debugging,
> messages always have correct headers (subject, to, from, etc) but then the
> info is lost somewhere.
> Thanks
> Adam
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.