[Tutor] working with email module

Rick Pasotto rick at niof.net
Sun Feb 21 20:53:54 CET 2010


I subscribe to an email list that distributes image files. I'd like to
automate the process of saving the images to individual files. I've got
it mostly figured out with two exceptions.

1) Sometimes msg.filename returns 'None' even though
msg.get_content_type returns 'image/jpeg' and the actual message
(looking at it with a file viewer) *does* have a filename parameter.
When I use the 'v' command in 'mutt' the filename shows so why does
python fail to find it?

2) Is it possible to 'detach' a single subpart of a message? The docs
show msg.attach() to create an email but I can't find anything that
would allow deleting an attachment. I know how to delete an entire
message from a mailbox.

-- 
"There is no medicine like hope, no incentive so great, and no tonic so
 powerful as expectation of something tomorrow." -- Orison Marden
    Rick Pasotto    rick at niof.net    http://www.niof.net


More information about the Tutor mailing list