You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Willem.Jiang" <wi...@gmail.com> on 2010/07/02 10:53:35 UTC

Re: Problems with SMTP


The Builder's configure() method is called when camel context start.
At this time if the there is no message in the test.queue,  camel will not
send message to the smtp server.

Did you try to put some message into queue to see if the message is send to
the smtp server ?

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang 


unixployd wrote:
> 
> I tried to use Java DSL to configure my route from Active MQ to SMTP.
> That is the code:
> 
> public void configure() {
> String url = 
> "smtp://user@domain.com?password=password&to=rcpt@domain.com&debugMode=true";
> from("activemq:queue:test.queue?concurrentConsumers=20").process(new
> QueueSmtpProcessor()).to(url);
> }
> 
> I can't send emails.
> 
> But if I use Injection @Produce and create own producer when I get what I
> need.
> 
> 	@Produce
> 	ProducerTemplate prod;
> 	
> 	public void configure() {
> 		String url = 
> "smtp://user@domain.com?password=password&to=rcpt@domain.com&debugMode=true";
> 		from("activemq:queue:test.queue?concurrentConsumers=20").process(new
> QueueSmtpProcessor());
> 		
> 		prod.sendBody(body());
> 		System.out.println("Message is sent");
> 	}
> 
> Basing on Camel manuals I see that smtp Endpoint should successfully
> create Producer and handle all the stuff.
> What can be the problem?
> 
-- 
View this message in context: http://camel.465427.n5.nabble.com/Problems-with-SMTP-tp512137p512599.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problems with SMTP

Posted by "Willem.Jiang" <wi...@gmail.com>.
You can't use @Producer inject the template yourself.
Here is the mail thread[1] that you can take a look :)
[1]
http://camel.465427.n5.nabble.com/Best-way-to-retrieve-a-ProducerTemplate-created-in-a-camel-bundle-OSGI-td511695.html#a511695

Willem
----------------------------------
Apache Camel, Apache CXF committer
Open SOA http://www.fusesource.com
Blog http://willemjiang.blogspot.com
Tiwtter http://twitter.com/willemjiang 


unixployd wrote:
> 
> Problem is solved.
> Correctly configured message in Processor using setHeader and setBody. Now
> it sends successfully.
> 
> Seems like using @Produce somehow correctly resolves endpoint uri and
> configures it, but in route case it need to be configured explicitly.
> 
-- 
View this message in context: http://camel.465427.n5.nabble.com/Problems-with-SMTP-tp512137p654358.html
Sent from the Camel - Users mailing list archive at Nabble.com.