Gmail imap search does not get all messages.

B

Bart Kastermans

I am trying to use imaplib with gmail. I am finding however that with
the gmail server imaplib.search does not give the correct answer. See
the below traces (k is a server a my department, i is gmail).
k has 6 messages in the INBOX
i has 3 messages in the INBOX

However i.search(None, "ALL")
only gives as answer "1 2", missing the third message.

Any suggestions about what I might be doing wrong? Or is this a known
issue? I couldn't find anything by googling, but maybe I am using the
wrong search terms.

Best,
Bart


05:41.11 > FEIC2 SELECT INBOX
05:41.16 < * FLAGS (\Answered \Flagged \Deleted \Seen \Draft MATH
$Forwarded $label5 $label1 $label4 $label2 $label3 NonJunk $NotJunk
$Junk JunkRecorded)
05:41.16 < * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen
\Draft MATH $Forwarded $label5 $label1 $label4 $label2 $label3 NonJunk
$NotJunk $Junk JunkRecorded \*)] Flags permitted.
05:41.16 < * 6 EXISTS
05:41.16 < * 0 RECENT
05:41.16 < * OK [UIDVALIDITY xXxXxXxXxX] UIDs valid
05:41.16 < * OK [UIDNEXT xXxXxXxX] Predicted next UID
05:41.16 < FEIC2 OK [READ-WRITE] Select completed.
('OK', ['6']) 05:52.82 > FEIC3 SEARCH ALL
05:52.86 < * SEARCH 1 2 3 4 5 6
05:52.86 < FEIC3 OK Search completed.
('OK', ['1 2 3 4 5 6'])
10:23.16 > DKNG10 SELECT INBOX
10:23.30 < * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
10:23.30 < * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted
\Seen \*)]
10:23.30 < * OK [UIDVALIDITY xXxXxXxXx]
10:23.30 < * 3 EXISTS
10:23.30 < * 0 RECENT
10:23.30 < * OK [UNSEEN 3]
10:23.30 < * OK [UIDNEXT 7]
10:23.31 < DKNG10 OK [READ-WRITE] INBOX selected. (Success)
('OK', ['3']) 10:17.30 > DKNG9 SEARCH ALL
10:17.44 < * SEARCH 1 2
10:17.44 < DKNG9 OK SEARCH completed (Success)
('OK', ['1 2'])
 
B

Bart Kastermans

Quick update on the below:
the issue has disappeared by itself. I did not get to working on this
much since sending my last message. Now that I am looking at this the
issue has disappeared.


I am trying to use imaplib with gmail.  I am finding however that with
the gmail server imaplib.search does not give the correct answer.  See
the below traces (k is a server a my department, i is gmail).
k has 6 messages in the INBOX
i has 3 messages in the INBOX

However i.search(None, "ALL")
only gives as answer "1 2", missing the third message.

Any suggestions about what I might be doing wrong?  Or is this a known
issue?  I couldn't find anything by googling, but maybe I am using the
wrong search terms.

Best,
Bart

  05:41.11 > FEIC2 SELECT INBOX
  05:41.16 < * FLAGS (\Answered \Flagged \Deleted \Seen \Draft MATH
$Forwarded $label5 $label1 $label4 $label2 $label3 NonJunk $NotJunk
$Junk JunkRecorded)
  05:41.16 < * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen
\Draft MATH $Forwarded $label5 $label1 $label4 $label2 $label3 NonJunk
$NotJunk $Junk JunkRecorded \*)] Flags permitted.
  05:41.16 < * 6 EXISTS
  05:41.16 < * 0 RECENT
  05:41.16 < * OK [UIDVALIDITY xXxXxXxXxX] UIDs valid
  05:41.16 < * OK [UIDNEXT xXxXxXxX] Predicted next UID
  05:41.16 < FEIC2 OK [READ-WRITE] Select completed.
('OK', ['6'])>>> k.search(None,"ALL")

  05:52.82 > FEIC3 SEARCH ALL
  05:52.86 < * SEARCH 1 2 3 4 5 6
  05:52.86 < FEIC3 OK Search completed.
('OK', ['1 2 3 4 5 6'])

  10:23.16 > DKNG10 SELECT INBOX
  10:23.30 < * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
  10:23.30 < * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted
\Seen \*)]
  10:23.30 < * OK [UIDVALIDITY xXxXxXxXx]
  10:23.30 < * 3 EXISTS
  10:23.30 < * 0 RECENT
  10:23.30 < * OK [UNSEEN 3]
  10:23.30 < * OK [UIDNEXT 7]
  10:23.31 < DKNG10 OK [READ-WRITE] INBOX selected. (Success)
('OK', ['3'])>>> i.search(None,"ALL")

  10:17.30 > DKNG9 SEARCH ALL
  10:17.44 < * SEARCH 1 2
  10:17.44 < DKNG9 OK SEARCH completed (Success)
('OK', ['1 2'])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top