0

I am trying to write apache Camel Mail component receiver using spring boot. Here is the code that I have written :

@Component
public class MyEmailRouter extends RouteBuilder {

    @Override
    public void configure() throws Exception {
         from("imaps://imap.gmail.com?username=XXX&password=XXX&consumer.delay=60000&delete=false&unseen=true&debugMode=false&searchTerm.fromSentDate=now-24h&searchTerm.unseen=true")
            .to("log:newmail");
    }
}

I am trying to fetch all unseen emails from last 24 hours. However, this is not logging anything.

When I add debugMode=true in the url, I get following logs:

    DEBUG IMAPS: mail.imap.fetchsize: 16384
    DEBUG IMAPS: mail.imap.ignorebodystructuresize: false
    DEBUG IMAPS: mail.imap.statuscachetimeout: 1000
    DEBUG IMAPS: mail.imap.appendbuffersize: -1
    DEBUG IMAPS: mail.imap.minidletime: 10
    DEBUG IMAPS: closeFoldersOnStoreFailure
    DEBUG IMAPS: trying to connect to host "imap.gmail.com", port 993, isSSL true
    * OK Gimap ready for requests from 111.122.212.118 b2mb183242253ioa
    A0 CAPABILITY
    * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN AUTH=OAUTHBEARER AUTH=XOAUTH
    A0 OK Thats all she wrote! b2mb183242253io
    DEBUG IMAPS: AUTH: XOAUTH2
    DEBUG IMAPS: AUTH: PLAIN
    DEBUG IMAPS: AUTH: PLAIN-CLIENTTOKEN
    DEBUG IMAPS: AUTH: OAUTHBEARER
    DEBUG IMAPS: AUTH: XOAUTH
    DEBUG IMAPS: protocolConnect login, host=imap.gmail.com, user=<non-null>, password=<non-null>
    DEBUG IMAPS: AUTHENTICATE PLAIN command trace suppressed
    DEBUG IMAPS: AUTHENTICATE PLAIN command result: A1 OK USERNAME authenticated (Success)
    A2 ENABLE UTF8=ACCEPT
    * ENABLED UTF8=ACCEPT
    A2 OK Success
    A3 LIST "" INBOX
    * LIST (\HasNoChildren) "/" "INBOX"
    A3 OK Success
    DEBUG IMAPS: connection available -- size: 1
    A4 SELECT INBOX
    * FLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotPhishing $Phishing)
    * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotPhishing $Phishing \*)] Flags permitted.
    * OK [UIDVALIDITY 1] UIDs valid.
    * 2804 EXISTS
    * 0 RECENT
    * OK [UIDNEXT 2811] Predicted next UID.
    * OK [HIGHESTMODSEQ 310772]
    A4 OK [READ-WRITE] INBOX selected. (Success)
    A5 FETCH 1 (FLAGS)
    * 1 FETCH (FLAGS ())
    A5 OK Success
    A6 FETCH 1 (ENVELOPE INTERNALDATE RFC822.SIZE)
    2019-05-01 11:20:56.451  INFO 3100 --- [       Thread-2] o.a.camel.spring.SpringCamelContext      : Apache Camel 2.23.2 (CamelContext: MyCamel) is shutting down
    2019-05-01 11:20:56.452  INFO 3100 --- [       Thread-2] o.a.camel.impl.DefaultShutdownStrategy   : Starting to graceful shutdown 1 routes (timeout 300 seconds)
    2019-05-01 11:20:56.455  INFO 3100 --- [ - ShutdownTask] o.a.camel.impl.DefaultShutdownStrategy   : Waiting as there are still 1 inflight and pending exchanges to complete, timeout in 300 seconds. Inflights per route: [route1 = 1]
    * 1 FETCH (RFC822.SIZE 4844 INTERNALDATE "31-Oct-2017 12:57:31 +0000" ENVELOPE ("Tue, 31 Oct 2017 05:57:31 -0700" "The best of Gmail, wherever you are" (("Gmail Team" NIL "mail-noreply" "google.com")) (("Gmail Team" NIL "mail-noreply" "google.com")) (("Gmail Team" NIL "mail-noreply" "google.com")) (("Aks" NIL "aks" "xyz.com")) NIL NIL NIL "<CAEDUrjNBDqUCUMGHVZ2x=gZ0Se5=e2jjp8hpkBECdDwqt_rfmw@mail.gmail.com>"))
    A6 OK Success
    A7 FETCH 2 (FLAGS)
    * 2 FETCH (FLAGS ())
aks
  • 1,019
  • 1
  • 9
  • 17
  • From what I can see in the debug output, `0 RECENT` indicates to me that there's no recent mail for you to poll. Are you *certain* there's something new in your inbox? – Makoto May 01 '19 at 06:25
  • yes, I even sent few after running application. Still, it was not generating any logs of new mail. – aks May 01 '19 at 14:58

0 Answers0