email module - getting unicode string from header?
Andrew McNamara
andrewm at object-craft.com.au
Thu Oct 14 09:45:26 EDT 2004
Given an email.Message.Message() object, what is the canonical way to
obtain a list of unicoded address headers? This is the effect I'm trying
to achieve, but it seems somewhat cumbersome:
>>> from email.Header import make_header, decode_header
>>> from email.Utils import formataddr, getaddresses
>>> [unicode(make_header(decode_header(formataddr(t))))
for t in getaddresses(m.get_all('to')+m.get_all('cc'))]
--
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
More information about the Python-list
mailing list