Function
email.Header.decode_header

Signature

decode_header(header)

Documentation String

Decode a message header value without converting charset.

Returns a list of (decoded_string, charset) pairs containing each of the decoded parts of the header. Charset is None for non-encoded parts of the header, otherwise a lower-case string containing the name of the character set specified in the encoded string.

An email.Errors.HeaderParseError may be raised when certain decoding error occurs (e.g. a base64 decoding exception).