Checking for 'new' POP3 mail

Python Addict init__self at my-deja.com
Wed Sep 15 15:56:13 EDT 1999


I'm writing a program that will try to intelligently examine the contents of
a user's POP3 mail spool and then forward certain matched mesages to one of
those groovy alpha pagers. After stripping out all the MIME bits and
graphics of course. The program will be long running (for days at a time if
a user is on a trip).

The poplib works brilliantly but there doesn't seem to be an obvious
built-in way to see what's 'new' between sweeps of the POP3 spool. Before I
attempt to write the next bit, I just wanted to see if I'm on the right
track with my thoughts.

Messages come and go so just purely checking on the number of messages in
the spool isn't going to work. Our POP server supports the optional UIDL
command which returns the message number, a space, and then a unique
identifier for each message.

I thought I'd take this list, chop off the message number and put the unique
message values into a list on the very first pass. On all other sweeps of
the POP3 spool, I could create a second list and then check against the
first to see if there were any new, unique message id's (and if so, do some
checking on them for further action). Then the original list would be tossed
away and replaced with the last list as it would be more up to date.

Am I making things complex for no reason or is there some built in
functionality I'm missing from the POP spec? Is there a Python-ish way of
comparing two lists that I might not be aware of? I was going to start at
the beginning of the second list, waddle through it, and search for each
element in the first list.

Thanks very much for any thoughts.






More information about the Python-list mailing list