retrieveing mail from a pop3 account

Mark Hammond MarkH at ActiveState.com
Thu Jul 27 19:52:25 EDT 2000


<jesse at multimediacollective.com> wrote in message
news:8lps39+ski at eGroups.com...
> Hey, I've been writing a program which connects to my Pop3 mail
> account, logs in, retrieves each mail in order and prints them out.
> (just printing to standard output for now).  However, say I have two
> messages in my mailbox.  It will print out the body of the first
> message TWICE.  So it will use the first body message as the body of
> every message.

You code assumes that messages are indexed from 0 - they are indexed from
1.

> Here is the code.
>     numMessages = len(open_mail.list()[1])
>     for index in range(numMessages):

Should be:
>     numMessages = len(open_mail.list()[1])
>     for index in range(1, numMessages+1):

The pop server should probably fail when asking for message 0, but there
may be a reason why it doesnt - Ive never read the relevant RFC in detail.

Mark.





More information about the Python-list mailing list