Python email

LutherRevisited lutherrevisited at aol.com
Tue Oct 12 01:46:58 CEST 2004


I still want to know about that POP3Magic thing, but I finally got this
working.  I couldn't figure out why until just now.  First I made sure I
retrieved the message as a list, then I iterated through it and concantenated
all that together into a string.  Then I cast that as an email object.  I
couldn't get the subsomething iterator thing to work, but I was able to walk
through it and check each part for content type.  If anyone's interested here's
my code I used to test to see that this actually  worked:
for x in M.retr(i)[1]:
            stringMail += x
            stringMail += '\n'
        inMail = email.message_from_string(stringMail)
        for part in inMail.walk():
            if part.get_content_type() == 'text/html':
                print part



More information about the Python-list mailing list