Question about email-handling modules
Robert Latest
boblatest at yahoo.com
Thu Dec 20 10:15:04 EST 2007
Steven D'Aprano wrote:
> message['to'] looks up the key 'to', raising an exception if it doesn't
> exist. message.get('to') looks up the key and returns a default value if
> it doesn't exist.
Ah, so the [] notation got hung up on some message right at the beginning
and didn't even let the script continue. Makes sense.
> All methods are attributes (although the opposite is not the case), so if
> a method doesn't exist, you will get an AttributeError.
I see. I've already gathered that Python likes to use different words for
common things (attribute instead of member or method).
> Damned if I can work out how to actually *use* the email module to read
> an mbox mail box. I might have to RTFM :(
Yeah, I think I haven't picked the right module to get started with.
> But note that message.get_payload() will return either a string (for
> single part emails) or a list of Messages (for multi-part messages).
Yes, I did note that.
Thanks for the tips (also to the others who have answered).
Python looks like fun though. Maybe I should try to tackle some other
problem first.
robert
More information about the Python-list
mailing list