search mail by date with imaplib

C

csselo

Hi
I am looking for a code sample which searches mail by date with imaplib

example:
get email from 01.01.2007 to now

how can I change imaplib search parameters?
 
R

rweth

Hi
I am looking for a code sample which searches mail by date with imaplib

example:
get email from 01.01.2007 to now

how can I change imaplib search parameters?
So I had to do the same thing a few years back. I love python but
seriously every author spends less than 1/10 of 1% on doc !

Well So do I .. so take it with a grain of salt. Here is what I did,
MANY YEARS AGO .. I don't even have a IMAP account anymore

t,data = M.uid("SEARCH",None,'(FROM blahblah)')
luid = string.split(data[0])
for uid in luid:
t,d = M.uid("FETCH",uid,"(BODY[HEADER.FIELDS (DATE SUBJECT TO)])")
date = d[0][1]

This will get you the dates .. and you can write your own
filter off that .. it's trivial. What isn't so great is
getting every piece of mail and then searching for the needle's in
the haystack.

So I guess this is plan c (just in case you don't get a better answer).
I will watch this one for a "plan a | b" answer.
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top