IMAP: How to implement GMail-like threaded conversations view
mrtot at gmx.de
Fri Dec 19 17:47:18 CET 2008
Currently I am trying to get used to Python's imaplib and email
I'like to create a webmail client simmilar to GMail.
a) Is there any feature hidden in Python's built-in modules (imaplib,
email) that already can group all my mails into threads?
b) If not a... what would be the best way to implement this?
I can think of two approaches:
b.1) Use the "References:" field of the messages in order to find out
which messages are related to each other.
I tried a first implementation which works quite well but I don't know
if there can occur situations where one message is related to two
parents. Also I don't know what happens if someone is too lazy to type
my address. He might click at "Reply", delete topic and old mail-text
and compose a new mail. Theoretically his mail client would set the
"References:" field accordingly never the less, wouldn't it? Therefore
my mail client would consider that completely new mail as part of an
The thoughts above might lead to the second approach:
b.2) Use the "Subject:" field of the messages.
I also tried this implementation and it also works (at first glance).
I stripped all subjects of all mails so that all those "Re:", "Fw:"
tags at the beginning get deleted. Afterwards I grouped those having
the same subject and the same participants. Problem: I have no clue
what "Re:"-tags might exist around the world. I guess each mail client
and each language uses different ones, right?
c) Does anyone know good resources to gain more knowledge about imap /
Currently I am using those sites as a reference:
(as a start *g)
Maybe there are other sources of interest on the web? :)
This is my first post in this newsgroup. So:
"Hello everybody!" :-)
I've been reading this group for quite a while and I am really
astonished how fast people give valuable answers here. This is a
really great community! Many thanks in advance for all ideas!
More information about the Python-list