POP3 Python Mail Download

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin F

    #1

    POP3 Python Mail Download

    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.blue bottle.com")
    print server.getwelco me()
    print server.user("ne urogasm@bluebot tle.com")
    print server.pass_("n eurogasm")

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

    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(msg Num)[1]
    messages = join(message, "\n")
    emails.append(m essage)
    ------------------------



    anyone know what's wrong? thanks.
  • Kent Johnson

    #2
    Re: POP3 Python Mail Download

    Kevin F wrote:[color=blue]
    > 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][/color]

    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

    Comment

    Working...