imaplib Search for Messages by Time

B

bw

Hello everyone.

I've been writing a program that interfaces with a user's GMail
account using OAuth, and I'm trying to find a way to search for
messages that were received only after a certain date AND time.

It seems pretty easy to get messages after a certain date. Here's the
relevant code that I have now, which works:

....
imap_conn = imaplib.IMAP4_SSL(imap_hostname)
imap_conn.authenticate('XOAUTH', lambda x: xoauth_string)
imap_conn.select('INBOX')
(typ, data) = imap_conn.search(None, '(SINCE "01-Nov-2010")')
....

But ideally I'd be able to do something like '(SINCE "01-Nov-2010
10:00:00")'.

I know that I can do this locally, but time is a critical factor here
so I'd like to avoid downloading any messages that I don't need.
Thanks!
 

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
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top