Hello All,

To poll the mail. I tried following code

CamelContext myCamelContext = new DefaultCamelContext();
 //final String url = "imap://
imap.gmail.com?username=myusern...@gmail.com&password=mypassword";
 //final String url = "smtp://
smtp.gmail.com:465?password=mypassword&username=myusern...@gmail.com";
 final String url = "pop3://myusern...@gmail.com?password=mypassword";
Endpoint endpoint = myCamelContext.getEndpoint(url);
 System.out.println(" endpoint " + endpoint);

RouteBuilder routeBuilder = new RouteBuilder(myCamelContext) {
 @Override
public void configure() throws Exception {
   from(url).process(new MyMailProcessor());
 }
};

myCamelContext.addRoutes(routeBuilder);
 myCamelContext.start();
MyMailProcessor.java

public class MyMailProcessor implements Processor {

    public void process(Exchange exchng) throws Exception {
System.out.println("" + exchng);
    }
}

As i understand when message is read from my Inbox *process* method of
MyMailProcessor executes.

Please correct me if i'm wrong. I am very new to this.

I am using camel-mail v2.8.2 and NetBeans 7 on Win XP.


On Thu, Nov 3, 2011 at 3:16 PM, Bilgin Ibryam <bibr...@gmail.com> wrote:

> Usually my approach for learning a new Camel component (and any open
> source application) is this:
>
> 1. Check the component description page.
>
> 2. If that's not enough jump into the source code and see it myself
> (looking at the test also helps a lot)
>
> 3. If I still cannot solve my issue, ask in the user list the exact
> problem providing full description of the version used and so on.
>
> HTH
> Bilgin
>
>
>
> On Thu, Nov 3, 2011 at 5:23 AM, Ketan Barapatre 
> <ketanbarapa...@gmail.com>wrote:
>
>> I have created maven app and my code is working now. Thank You very much.
>>  [?]
>>
>> Can you please guide me on How can i proceed now means after getting
>> Endpoint object ? Any documentation or tutorial for reading mail will help
>> me a lot.
>>
>> Thank you very much.
>>
>> On Wed, Nov 2, 2011 at 4:28 PM, Ketan Barapatre <ketanbarapa...@gmail.com
>> > wrote:
>>
>>> I have created test project added camel-mail in my class path and other
>>> jars are also in classpath which comes with camel download.
>>>
>>> I will create Maven project and try this  but is anything wrong if i
>>> don't use maven.
>>>
>>> Thank You
>>> Ketan
>>>
>>>
>>> On Wed, Nov 2, 2011 at 3:28 PM, Bilgin Ibryam <bibr...@gmail.com> wrote:
>>>
>>>> Do you have mail component added to your project with correct camel
>>>> version? Something like this?
>>>>
>>>>
>>>> <dependency>
>>>>    <groupId>org.apache.camel</groupId>
>>>>    <artifactId>camel-mail</artifactId>
>>>>    <version>x.x.x</version>
>>>>    <!-- use the same version as your Camel core version -->
>>>> </dependency>
>>>>
>>>> Bilgin
>>>>
>>>> On Tue, Nov 1, 2011 at 6:37 PM, Ketan Barapatre
>>>> <ketanbarapa...@gmail.com> wrote:
>>>> > I have been through the provided links and documentation. Now I want
>>>> to
>>>> > read mails from gmail server.
>>>> >
>>>> > I am getting exception in following code. Please correct my mistake
>>>> i'm new
>>>> > to this. I may have mistaken in creating URL.
>>>> >
>>>> > CamelContext myCamelContext = new DefaultCamelContext();
>>>> > String url = "smtp://
>>>> > smtp.gmail.com:465?password=mypassword&username=myusername";
>>>> > //String url = "pop3://
>>>> > smtp.gmail.com:465?password=mypassword&username=myusername";
>>>> > //String url = "imap://
>>>> > smtp.gmail.com:465?password=mypassword&username=myusername";
>>>> >  Endpoint endpoint = myCamelContext.getEndpoint(url);
>>>> >  System.out.println(" endpoint " + endpoint);
>>>> >
>>>> > *Exception *
>>>> >
>>>> > [                          main] AnnotationTypeConverterLoader  INFO
>>>>  Found
>>>> > 3 packages with 15 @Converter classes to load
>>>> > [                          main] DefaultTypeConverter           INFO
>>>> >  Loaded 163 core type converters (total 163 type converters)
>>>> > [                          main] AnnotationTypeConverterLoader  INFO
>>>> >  Loaded 27 @Converter classes
>>>> > Exception in thread "main"
>>>> org.apache.camel.ResolveEndpointFailedException:
>>>> > Failed to resolve endpoint: smtp://
>>>> >
>>>> smtp.gmail.com:465?password=mypassword&username=myusername%40gmail.comdue
>>>> > to: org.apache.camel.TypeConverterLoaderException: Failed to load type
>>>> > converters because of: Cannot find any type converter classes from the
>>>> > following packages:
>>>> [org.apache.camel.scala.converter.ScalaTypeConverter]
>>>> > Java Result: 1
>>>> >
>>>> > On Sun, Oct 30, 2011 at 7:16 AM, Bilgin Ibryam <bibr...@gmail.com>
>>>> wrote:
>>>> >
>>>> >> Hi Ketan,
>>>> >>
>>>> >> A good starting point for Camel is
>>>> >> http://camel.apache.org/getting-started.html
>>>> >> and Camel in Action book.
>>>> >>
>>>> >> For receiving emails you have to take a look at the examples here
>>>> >> http://camel.apache.org/mail.html
>>>> >> Also reading the tests from the source code helps a lot understanding
>>>> >> the components.
>>>> >>
>>>> >> HTH
>>>> >> Bilgin Ibryam
>>>> >>
>>>> >> On Sat, Oct 29, 2011 at 8:43 AM, Ketan Barapatre
>>>> >> <ketanbarapa...@gmail.com> wrote:
>>>> >> > Hello All,
>>>> >> >
>>>> >> > I want to develop an application where I can get the text of
>>>> incoming
>>>> >> > mails (gmail or any mail server). Mail can be of plain text or
>>>> >> > text\html types.
>>>> >> > I am new to Apache Camel. Please guide me.
>>>> >> >
>>>> >> > --
>>>> >> >
>>>> >> > Regards
>>>> >> > Ketan Barapatre
>>>> >> >
>>>> >>
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> >
>>>> > Regards
>>>> > Ketan Barapatre
>>>> >
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> Regards
>>> Ketan Barapatre
>>>
>>>
>>>
>>
>>
>> --
>>
>> Regards
>> Ketan Barapatre
>>
>>
>>
>


-- 

Regards
Ketan Barapatre

Reply via email to