Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8066C98A4 for ; Sun, 20 Nov 2011 06:38:45 +0000 (UTC) Received: (qmail 60335 invoked by uid 500); 20 Nov 2011 06:38:44 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 60298 invoked by uid 500); 20 Nov 2011 06:38:41 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 60290 invoked by uid 99); 20 Nov 2011 06:38:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Nov 2011 06:38:39 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ketanbarapatre@gmail.com designates 74.125.82.51 as permitted sender) Received: from [74.125.82.51] (HELO mail-ww0-f51.google.com) (74.125.82.51) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Nov 2011 06:38:34 +0000 Received: by wwe6 with SMTP id 6so5636279wwe.20 for ; Sat, 19 Nov 2011 22:38:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Ws7lQQOA9ZdXU3tiLycJqSFvFAWSRND480hk5Q7uDRg=; b=bD487pWphp8s97tmJ+xgNqoTaVqHNT0Zx60UFXtyTNGsgrkIfXbaRjxO9OuAEJei1X d5XZ4vLsmo3c4lYNi4HnI7eDGpyZS2a7SbbaINMFnP+LD5vP/D/aDpwINsSeM3UU8+ZI k9qSN8x1LDfYuUPBm/x4IAEnQayDvZSWMDH5w= Received: by 10.180.7.97 with SMTP id i1mr9408549wia.23.1321771093092; Sat, 19 Nov 2011 22:38:13 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.77.234 with HTTP; Sat, 19 Nov 2011 22:37:52 -0800 (PST) In-Reply-To: References: From: Ketan Barapatre Date: Sun, 20 Nov 2011 12:07:52 +0530 Message-ID: Subject: Re: Regarding mail reading To: users@camel.apache.org Content-Type: multipart/alternative; boundary=f46d041555f07a683004b224d0b5 --f46d041555f07a683004b224d0b5 Content-Type: text/plain; charset=ISO-8859-1 Thank You Bilgin Worked for me. I read Mail Component Options to understand delay and wait to start polling finally it started. Now am trying to parse *org.apche.camel.Message* object to get the content of message ( mail can be text/html or text/plain ). Any suggestion ? Once again Thank You very much for help. On Sat, Nov 19, 2011 at 4:34 AM, Bilgin Ibryam wrote: > You need to have something like this in your doInBackground method instead: > > main = new Main(); > main.enableHangupSupport(); > main.addRouteBuilder(new MyRouteBuilder()); > main.run(); > > Bilgin > > On Fri, Nov 18, 2011 at 6:20 PM, Ketan Barapatre > wrote: > > > > Thank You for reply. > > > > I did two things but not getting any result. > > > > 1. Created Simple UI with JButton and Created > > > > class MailPoller public class MailPoller extends > javax.swing.SwingWorker{ > > > > public Object doInBackground() throws Exception{ > > > > try { > > > > camelContext.addRoutes(new RouteBuilder() { > > > > @Override > > public void configure() throws Exception { > > from("imaps://imap.gmail.com? > > username=myusername@gmail.com&password=mypassword" > > + > > "&delete=false&unseen=true&consumer.delay=60000").to("log:newmail"); > > System.out.println("Configured"); > > > > } > > }); > > camelContext.start(); > > > > } catch (Exception ex) { > > Logger.getLogger(MailPoller.class.getName()).log(Level.SEVERE, > > null, ex); > > } > > } > > } > > > > > > 2 . > > > > class MainExample { > > ....... > > ....... > > ....... > > private static class MyRouteBuilder extends RouteBuilder { > > > > @Override > > public void configure() throws Exception { > > from("imaps:// > imap.gmail.com?username=myusername@gmail.com&password=mypassword" > > + > > "&delete=false&unseen=true&consumer.delay=60000").process(new > > Processor() { > > > > public void process(Exchange exchange) throws Exception { > > System.out.println("Invoked timer at " + new Date()); > > } > > }); > > } > > } > > > > ....... > > } > > > > Please guide me. > > > > On 11/18/11, Claus Ibsen wrote: > > > Hi > > > > > > You need to keep your main thread running. The start() on CamelContext > > > is a non blocking operation. > > > > > > See this FAQ > > > > http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html > > > > > > > > > On Thu, Nov 17, 2011 at 7:35 PM, Ketan Barapatre > > > wrote: > > >> Hello Bilgin > > >> > > >> I read SSL and Enable POP and IMAP in my gmail account. > > >> I have written code for polling mail but not getting any result. It > > >> must be my mistake somewhere. > > >> > > >> Please help me to correct my code. I want to read mails to complete my > > >> project. > > >> > > >> public class MailPoller { > > >> > > >> public static void main(String[] args) { > > >> try { > > >> CamelContext myCamelContext = new DefaultCamelContext(); > > >> RouteBuilder routeBuilder = new > RouteBuilder(myCamelContext) { > > >> > > >> @Override > > >> public void configure() throws Exception { > > >> > > >> from("imaps:// > imap.gmail.com?username=myusername@gmail.com&password=mypassword" > > >> + > > >> "&delete=false&unseen=true").to("log:newmail"); > > >> } > > >> }; > > >> > > >> myCamelContext.start(); > > >> > > >> } catch (Exception ex) { > > >> > Logger.getLogger(MailPoller.class.getName()).log(Level.SEVERE, > > >> null, ex); > > >> } > > >> } > > >> } > > >> > > >> On 11/11/11, Bilgin Ibryam wrote: > > >>> Hi Ketan, > > >>> > > >>> Please read (again) the SSL section of mail component documentation > from > > >>> Camel website and check the example there. Then you have to enable > pop > > >>> for > > >>> your gmail account in the settings. > > >>> > > >>> Finally the rout should look like something like this: > > >>> > > >>> pop3s://pop.gmail.com?username=.... > > >>> > > >>> or > > >>> > > >>> imaps://imap.gmail.com?username=... > > >>> > > >>> notice the S in the schemas > > >>> > > >>> > > >>> HTH > > >>> Bilgin > > >>> > > >>> > > >>> On Thu, Nov 10, 2011 at 3:22 PM, Ketan Barapatre > > >>> wrote: > > >>> > > >>>> Hello All, > > >>>> > > >>>> To poll the mail. I tried following code > > >>>> > > >>>> CamelContext myCamelContext = new DefaultCamelContext(); > > >>>> //final String url = "imap:// > > >>>> imap.gmail.com?username=myusername@gmail.com&password=mypassword"; > > >>>> //final String url = "smtp:// > > >>>> > smtp.gmail.com:465?password=mypassword&username=myusername@gmail.com"; > > >>>> final String url = "pop3:// > myusername@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. > > >>>> > > >>>> > > >>>> > > >>> > > >> > > >> > > >> -- > > >> > > >> Regards > > >> Ketan Barapatre > > >> > > > > > > > > > > > > -- > > > Claus Ibsen > > > ----------------- > > > FuseSource > > > Email: cibsen@fusesource.com > > > Web: http://fusesource.com > > > Twitter: davsclaus, fusenews > > > Blog: http://davsclaus.blogspot.com/ > > > Author of Camel in Action: http://www.manning.com/ibsen/ > > > > > > > > > -- > > > > Regards > > Ketan Barapatre > -- Regards Ketan Barapatre --f46d041555f07a683004b224d0b5--