You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by nickerox <ma...@tiscali.it> on 2013/05/18 19:04:44 UTC

Re: camel-mail

Hi Claus,

I`m testing this simple java code:

CamelContext ctx = new DefaultCamelContext();

		ctx.addRoutes(new RouteBuilder() {

			@Override
			public void configure() throws Exception {

				from("direct:mail").
				 setHeader("subject", constant("Apache camel test"))
				.setHeader("From", constant("test@virgilio.it"))
				.to("smtp://username@virgilio.it?password=****");
			}
		});
		
		ctx.start();
		
		Endpoint endpoint = ctx.getEndpoint("direct:mail");
		
		ProducerTemplate p = new DefaultProducerTemplate(ctx, endpoint);
		p.start();
		p.sendBody("Hello!");
		System.out.println("Sent!");
		p.stop();
		ctx.stop(); 


receiving this response: Could not connect to SMTP host: virgilio.it, port:
25 (right, because SMTP server is out.virgilio.it);
If i substitute the endpoint with 
"smtp://username@out.virgilio.it?password=****"
 I get the right AddressFailedException.
So, please, could you help me to understand my error or if i have missed any
properties?
Thx in advance




--
View this message in context: http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5732800.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-mail

Posted by nickerox <ma...@tiscali.it>.
It works adding "to" property. Many thx



--
View this message in context: http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5732817.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: camel-mail

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

If you see any exception then that may have details that can lead you
to what is wrong etc. And make sure your username and password is
correct.

Also you need to set a header with the "to" eg with the email to who
is to receive the email.
setHeader("to", constant("someone@somewhere.com"))



On Sat, May 18, 2013 at 7:04 PM, nickerox <ma...@tiscali.it> wrote:
> Hi Claus,
>
> I`m testing this simple java code:
>
> CamelContext ctx = new DefaultCamelContext();
>
>                 ctx.addRoutes(new RouteBuilder() {
>
>                         @Override
>                         public void configure() throws Exception {
>
>                                 from("direct:mail").
>                                  setHeader("subject", constant("Apache camel test"))
>                                 .setHeader("From", constant("test@virgilio.it"))
>                                 .to("smtp://username@virgilio.it?password=****");
>                         }
>                 });
>
>                 ctx.start();
>
>                 Endpoint endpoint = ctx.getEndpoint("direct:mail");
>
>                 ProducerTemplate p = new DefaultProducerTemplate(ctx, endpoint);
>                 p.start();
>                 p.sendBody("Hello!");
>                 System.out.println("Sent!");
>                 p.stop();
>                 ctx.stop();
>
>
> receiving this response: Could not connect to SMTP host: virgilio.it, port:
> 25 (right, because SMTP server is out.virgilio.it);
> If i substitute the endpoint with
> "smtp://username@out.virgilio.it?password=****"
>  I get the right AddressFailedException.
> So, please, could you help me to understand my error or if i have missed any
> properties?
> Thx in advance
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5732800.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

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