POP3 Python Mail Download

K

Kevin F

Having some troubles downloading messages with POP3...

I can connect to the server just fine and list messages without any
problem with the following code:

------------------------
from poplib import *

server = POP3("mail.bluebottle.com")
print server.getwelcome()
print server.user("(e-mail address removed)")
print server.pass_("neurogasm")

messagesInfo = server.list()[1]
numMessages = len(messagesInfo)

print numMessages
------------------------



However, if I try to actually download the messages themselves, my
python editor highlights 'msgSize' and says "invalid syntax" when I run
the following subsequent lines of code:


------------------------
emails = []
for msg in messagesInfo:
msgNum = int(split(msg, " ")[0]
msgSize = int(split(msg, " ")[1]
if(msgSize < 20000):
messages = server.retr(msgNum)[1]
messages = join(message, "\n")
emails.append(message)
 
K

Kent Johnson

Kevin said:
However, if I try to actually download the messages themselves, my
python editor highlights 'msgSize' and says "invalid syntax" when I run
the following subsequent lines of code:


------------------------
emails = []
for msg in messagesInfo:
msgNum = int(split(msg, " ")[0]
msgSize = int(split(msg, " ")[1]

You have an inconsistent indent in the two lines above. All the lines in
a block must have the same indent (except sub-blocks of course).

Kent
 

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,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top