Name

get_payload

Synopsis

                        m.get_payload(i=None,decode=False)

Returns m’s payload. When m .is_multipart( ) is False, i must be None, and m .get_payload( ) returns m’s entire payload, a string or a Message instance. If decode is true, and the value of header Content-Transfer-Encoding is either 'quoted-printable' or 'base64', m .get_payload also decodes the payload. If decode is false, or header Content-Transfer-Encoding is missing or has other values, m .get_payload returns the payload unchanged.

When m .is_multipart( ) is True, decode must be false. When i is None, m .get_payload( ) returns m’s payload as a list. Otherwise, m .get_payload( ) returns the ith item of the payload, and raises TypeError if i is less than 0 or is too large.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.