Python email
Tim Williams
listserver at tdw.net
Sun Oct 10 19:26:52 EDT 2004
More information about the Python-list mailing list
Sun Oct 10 19:26:52 EDT 2004
- Previous message (by thread): Python email
- Next message (by thread): Python email
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"LutherRevisited" <lutherrevisited at aol.com> wrote in message news:20041010135948.07384.00002435 at mb-m29.aol.com... > I'm attempting to write an email client, and I've run into a snag. I've seen > several docs on email, but they're not dumbed down enough for me. Basically > I'm downloading my messages like this: > M = poplib.POP3('pop.mail.yahoo.com') > M.user('username') > M.pass_('password') > inMail = str(M.retr(i)) > and I get the message just fine, but I want to pull out of all that just the > html part. How can I do this. as a pointer using your inMail string (untested, and you should read the docs for the email module to find the functions that will really suit your requirements) import email emailobj = email.message_from_string(inMail) # or emailobj = email.message_from_string( str(M.retr(i)) ) if not emailobj.is_multipart(): # return/break/pass etc e_payload = emailobj.get_payload() #then something like for x in range(len(e_payload)): e_name = e_payload[x].get_filename() #or e_type = e_payload[x].get_content_type() # I doubt the last two functions will do what you need, but there will be functions in the email module that you can use in their place
- Previous message (by thread): Python email
- Next message (by thread): Python email
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list