[Chicago] imaplib and gmail... the inbox count is wrong! Wrong, I tell ya!

Dan Krol orblivion at gmail.com
Sat Feb 21 02:42:17 CET 2009

I'll say this, sometimes my inbox count on the web is wrong. I've
gotten the likes of "1-100 of 101", through weird orders of archiving

On 2/20/09, Jason Huggins <jason at jrandolph.com> wrote:
> Hiya, folks!
> I tried googling this, but nothing came up in my quest... so I'm
> switching to "Let's ask some humans" mode.
> I'm trying to get an accurate count of the total number of messages
> (read and unread) in my Inbox.
> Here's my code:
>>>> import imaplib
>>>> mail = imaplib.IMAP4_SSL('imap.gmail.com', 993)
>>>> mail.login('larry at gmail.com','sergey_is_my_homeboy')
> ('OK', ['larry at gmail.com authenticated (Success)'])
>>>> status, count = mail.select ('Inbox')
>>>> status, count
> ('OK', ['9332'])
> If I log into Gmail through the web, the inbox count is different (and
> thousands less than 9332). The 9332 number appears to be the number if
> I open "All Mail" through the web. Is there a way to *just* get the
> number of messages in the inbox? It feels like the above code should
> give me the accurate number, but it's not.
> Thanks!
> - jason
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago

More information about the Chicago mailing list