def text(message):
"""Returns the plain text of the message. If the message is multipart search
for an attachment with no filename and with mimetype `text/plain` and returns
it.
Parameters
----------
message: email.message.Message
Message to decode.
Returns
-------
message_text: str
Returns the plain text of the message. This method will try return the text
encoded to `utf-8`. If it can't, returns it with its original encoding. If
it can't find the text returns `None`.
Raises
------
TypeError
If the parameter is not an instance of :class:`email.message.Message`.
"""
return Text.decoded(message, ['text/plain'])
评论列表
文章目录