473,386 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

search mail by date with imaplib

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?

Jan 6 '07 #1
1 5670
cs****@gmail.com wrote:
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.
Jan 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Colin Brown | last post by:
The Python 2.3 documentation in imaplib says: Internaldate2tuple( datestr) Converts an IMAP4 INTERNALDATE string to Coordinated Universal Time. Returns a time module tuple. Time2Internaldate(...
4
by: Raghul | last post by:
Hi Friends, I am doing project in python.I am new to this. My problem is I want to move the mail message to other folder in the mail using imaplib (E.g) I want to move a message from the inbox...
0
by: Wolfgang Kohnen | last post by:
Hello out there! I am new to python and so far I like it a lot. Now I want to create some IMAP mailboxes on my cyrus imapd, with quotas and each user should be subscribed to her/his own spam...
0
by: Luis Corrales | last post by:
Hi all, I have a problem when searching for text with special characters in e-mails in an IMAP server. I'm using imaplib in python 2.4.3 and I can't get this code working: # first connect and...
0
by: venugopalsripada | last post by:
Hi, I use imaplib to download emails from my AOL accounts. I have 6 accounts. I am recieving ('NO', ) as a return value for search(None, 'ALL') for one of the accounts while all other acocunts are...
5
by: Antoon Pardon | last post by:
This little program gives IMO a strange result. import imaplib user = "cpapen" cyr = imaplib.IMAP4("imap.vub.ac.be") cyr.login("cyrus", "cOn-A1r") rc, lst = cyr.list('""', "user/%s/*" %...
0
by: Laszlo Nagy | last post by:
Hi, I'm using imaplib to access an IMAP4 server. I'm reading the IMAP4 specification, and I found something odd. The search command can be used in conjuction with date values. For example, I...
2
by: Roopesh | last post by:
I am using the imaplib to fetch mails. There is an error thrown in the search function, which I am not able to comprehend. My program is as follows : ==================== import imaplib M =...
1
by: aspineux | last post by:
imaplib use exception to report errors, but some problems must be detected by checking the return value ! For example, when trying to append into a mailbox with wrong ACL, imaplib return 'NO',...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.