camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: How To Get The SMTP Message-ID
Date Wed, 26 Dec 2012 08:35:50 GMT
Hi

Did you get any headers at all? See this FAQ
http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html

You may want to use hasOut to only access the OUT if there is actually
an OUT message.
If not then access the IN instead.

See the FAQ why.


On Mon, Dec 24, 2012 at 7:11 PM, John.R.Moore <john.moore@kronos.com> wrote:
> I have a system where I need to record the SMTP Message-ID for every sent
> message and use to correlate back responses.   I followed the simple sending
> via SMTP examples from http://camel.apache.org/mail.html and had hoped to
> find the returned reference somewhere in the exchange to no avail.
>
> Is the message-id available in the exchange and I'm just not finding it or
> do I need to handle the sending of the SMTP message myself and push into the
> exchange.out?
>
> Thanks in advance,
> John
>
>                 <route id="sendToMail">
>                         <from uri="direct:toSMTP"/>
>                         <pipeline>
>                                 <to
> uri="smtps://smtp.mail.**********.com?username=johnmoore330@ymail.com&amp;password=**********&amp;to=******@*****.com&amp;from=*******@*****.com&amp;subject=offers"
> />
>                                 <process  ref="dummyProcessor" />
>                         </pipeline>
>                         <to uri="mock:sentmail"/>
>                 </route>
>
>
>
>         @Test
>         public void testSmtpSend() throws Exception {
>
>                 assertEquals(ServiceStatus.Started, context.getStatus());
>
>                 Exchange exchange = sendMail.createExchange();
>                 Message in = exchange.getIn();
>                 in.setBody("John Was Here");
>                 Producer producer = sendMail.createProducer();
>                 producer.start();
>                 producer.process(exchange);
>                 System.out.println("sent mail");
>                 Map<String, Object> headers = exchange.getOut().getHeaders();
>                 for (String key : headers.keySet()) {
>                         System.out.println(key + " " + headers.get(key));
>                 }
>
>         }
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-To-Get-The-SMTP-Message-ID-tp5724581.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message