You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by RUPA JAIN <ru...@gmail.com> on 2013/07/24 09:24:13 UTC
sending mail using camel
Hi,
when i am writing following code for sending mail in camel context
<route>
<from uri="direct:start_4" />
<to uri="com__iexceed__appzillonapp__Mail_Req" />
</route>
<endpoint id="com__iexceed__appzillonapp__Mail_Req"
uri="smtps://smtp.gmail.com?username=abc@gmail.com&password=*******&to=xyz@gmail.com"
/>
// the following code is in camelmailclient class
exchange = producer
.request(
FrameworksStartup.getInstance().getUriMap().get(camelID),
new Processor() {
public void process(Exchange exchange)
throws Exception {
exchange.getIn().setBody(bodystring);
}
});
then giving exception:
org.apache.camel.RuntimeCamelException:
org.apache.camel.FailedToCreateRouteException: Failed to create route route5
at: >>> To[com__iexceed__appzillonapp__Mail_Req]
<<< in route: Route[[From[direct:start_4]] ->
[To[com__iexceed__appzillona... because of Failed to resolve endpoint:
com__iexceed__appzillonapp__Mail_Req due to: Fa
iled to resolve endpoint: com__iexceed__appzillonapp__Mail_Req:2 due to:
Illegal character in scheme name at index 3:
com__iexceed__appzillonapp__Mail_Req:2
but if i am hard coding the uri in camelmailclient then it is working fine
sending mail:
exchange = producer
.request(
"smtps://smtp.gmail.com?username=abc@gmail.com&password=******&to=xyz@gmail.com",
new Processor() {
public void process(Exchange exchange)
throws Exception {
exchange.getIn().setBody(bodystring);
}
});
Any idea what changes i need to do in came-context.xml .
Thanks for your help.
--
View this message in context: http://camel.465427.n5.nabble.com/sending-mail-using-camel-tp5736177.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: sending mail using camel
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Use
<to ref="com__iexceed__appzillonapp__Mail_Req"/>
eg use ref to refer to the endpoint by its id.
On Wed, Jul 24, 2013 at 9:24 AM, RUPA JAIN <ru...@gmail.com> wrote:
> Hi,
> when i am writing following code for sending mail in camel context
> <route>
> <from uri="direct:start_4" />
>
> <to uri="com__iexceed__appzillonapp__Mail_Req" />
> </route>
>
> <endpoint id="com__iexceed__appzillonapp__Mail_Req"
>
> uri="smtps://smtp.gmail.com?username=abc@gmail.com&password=*******&to=xyz@gmail.com"
> />
> // the following code is in camelmailclient class
> exchange = producer
> .request(
> FrameworksStartup.getInstance().getUriMap().get(camelID),
> new Processor() {
> public void process(Exchange exchange)
> throws Exception {
>
> exchange.getIn().setBody(bodystring);
>
> }
>
> });
>
> then giving exception:
> org.apache.camel.RuntimeCamelException:
> org.apache.camel.FailedToCreateRouteException: Failed to create route route5
> at: >>> To[com__iexceed__appzillonapp__Mail_Req]
> <<< in route: Route[[From[direct:start_4]] ->
> [To[com__iexceed__appzillona... because of Failed to resolve endpoint:
> com__iexceed__appzillonapp__Mail_Req due to: Fa
> iled to resolve endpoint: com__iexceed__appzillonapp__Mail_Req:2 due to:
> Illegal character in scheme name at index 3:
> com__iexceed__appzillonapp__Mail_Req:2
>
> but if i am hard coding the uri in camelmailclient then it is working fine
> sending mail:
> exchange = producer
> .request(
>
> "smtps://smtp.gmail.com?username=abc@gmail.com&password=******&to=xyz@gmail.com",
> new Processor() {
> public void process(Exchange exchange)
> throws Exception {
>
> exchange.getIn().setBody(bodystring);
>
> }
>
> });
>
>
> Any idea what changes i need to do in came-context.xml .
>
> Thanks for your help.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/sending-mail-using-camel-tp5736177.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen