Thank you James.

Using the Java code you indicated:

MailComponent component = new MailComponent(); 
component.getConfiguration().setHost("myMailServerHost"); 
...

Does the instance must be put in a Camel context? Like this:
camelContext.put("mail", component); 

Sorry, I don't see the relation with JNDI, and the URI I can use like in my
sample code.
Must I use something like ... .to(smtp://...) or ... .to(mail: ...)?

Cheers,

Bertrand.



James.Strachan wrote:
> 
> So the idea is that things like host names of your mail server or JMS
> server can be configured on a Component, then the endpoints don't have
> to have all that configuration in them. e.g. a mail endpoint can be
> just the email address; or a JMS endpoint can be just the queue/topic
> name etc.
> 
> http://activemq.apache.org/camel/endpoint.html
> http://activemq.apache.org/camel/component.html
> 
> 
> So the idea is you can configure the component with things like JMS
> ConnectionFactory, or JPA EntityManagerFactory or whatnot; then just
> use the endpoints as nice and simple URIs. So in the case of the mail
> component you can configure the MailComponent with all the various
> connection details via the MailConfiguration POJO which has a bunch of
> setters for things like the host/port of your mail server etc.
> 
> so if you are using spring you could do something like
> 
> <bean id="mail" class="org.apache.camel.component.mail.MailComponent">
>   <property name="configuration">
>    <bean class="org.apache.camel.component.mail.MailConfiguration">
>      <property name="host" value="myMailServerHost">
> ...
> 
> 
> or if you are using Java code and not using spring you could add a
> configured MailComponent into JNDI
> 
> 
> MailComponent component = new MailComponent();
> component.getConfiguration().setHost("myMailServerHost");
> context.put("mail", component);
> 
> 
> On 9/14/07, bgoetzmann <[EMAIL PROTECTED]> wrote:
>>
>> Thank you.
>> Yes I saw this file ; but how define this property and others (the "from"
>> or
>> "suject") using Java DSL?
>>
>> Here my test class:
>>
>>
>> public class Test {
>>
>>         /**
>>          * @param args
>>          * @throws Exception
>>          */
>>         public static void main(String[] args) throws Exception {
>>                 CamelContext context = new DefaultCamelContext();
>>
>>                 context.addRoutes(new RouteBuilder() {
>>
>>                     public void configure() {
>>                        
>> from("timer:myTimerEvent?fixedRate=true&delay=0&period=1000")
>>                                   // this works!
>>                         //.setBody(Builder.constant("Salut
>> !")).to("log:test");
>>
>>                                   // How define smtp host?
>>                         .setBody(Builder.constant("Salut
>> !")).to("smtp://[EMAIL PROTECTED]");
>>
>>                     }
>>
>>                 });
>>
>>                 context.start();
>>
>>                 Thread.sleep(5000);
>>
>>         }
>>
>> }
>>
>>
>>
>> Frank Lynch-2 wrote:
>> >
>> > Hi Bertrand,
>> > I believe "[EMAIL PROTECTED]" is the address to which the email will be
>> > delivered.
>> > You can set the SMTP server via a properties object eg:
>> >
>> >         Properties properties = new Properties();
>> >         properties.put("mail.smtp.host", "localhost");
>> >         mailSession = Session.getInstance(properties, null);
>> >
>> > This code fragment was taken from MailMessageTest.java in:
>> >  /components/camel-mail/src/test/java/org/apache/camel/component/mail/
>> > HTH,
>> > --Frank
>> >
>> >
>> >
>> > On Fri, 2007-09-14 at 08:32 -0700, bgoetzmann wrote:
>> >> Hi,
>> >>
>> >> Camel is a very interesting project ! Thank you for all developers of
>> >> this
>> >> project.
>> >>
>> >> Trying a first Java application I would like to send emails using a
>> route
>> >> ;
>> >> so I try something like
>> >>
>> >> ... .to("smtp://[EMAIL PROTECTED]")
>> >>
>> >> but is [EMAIL PROTECTED] must be a address mail at witch you send the
>> mail?
>> >> How
>> >> can I specify the smtp server?
>> >>
>> >> I appreciate an example.
>> >>
>> >> Thank you!
>> >>
>> >> Bertrand.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Sending-an-email-with-Camel-tf4443341s22882.html#a12678558
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Sending-an-email-with-Camel-tf4443341s22882.html#a12732735
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to