email.parser.Parser.parse()

parse(fp, headersonly=False) Read all the data from the file-like object fp, parse the resulting text, and return the root message object. fp must support both the readline() and the read() methods on file-like objects. The text contained in fp must be formatted as a block of RFC 2822 style headers and header continuation lines, optionally preceded by an envelope header. The header block is terminated either by the end of the data or by a blank line. Following the header block is the body of

email.parser.FeedParser.close()

close() Closing a FeedParser completes the parsing of all previously fed data, and returns the root message object. It is undefined what happens if you feed more data to a closed FeedParser.

email.parser.Parser

class email.parser.Parser(_class=email.message.Message, *, policy=policy.compat32) The constructor for the Parser class takes an optional argument _class. This must be a callable factory (such as a function or a class), and it is used whenever a sub-message object needs to be created. It defaults to Message (see email.message). The factory will be called without arguments. If policy is specified (it must be an instance of a policy class) use the rules it specifies to update the representatio

email.parser.BytesParser.parse()

parse(fp, headersonly=False) Read all the data from the binary file-like object fp, parse the resulting bytes, and return the message object. fp must support both the readline() and the read() methods on file-like objects. The bytes contained in fp must be formatted as a block of RFC 2822 style headers and header continuation lines, optionally preceded by an envelope header. The header block is terminated either by the end of the data or by a blank line. Following the header block is the bod

email.parser.BytesParser.parsebytes()

parsebytes(bytes, headersonly=False) Similar to the parse() method, except it takes a byte string object instead of a file-like object. Calling this method on a byte string is exactly equivalent to wrapping text in a BytesIO instance first and calling parse(). Optional headersonly is as with the parse() method.

email.parser.BytesParser

class email.parser.BytesParser(_class=email.message.Message, *, policy=policy.compat32) This class is exactly parallel to Parser, but handles bytes input. The _class and strict arguments are interpreted in the same way as for the Parser constructor. If policy is specified (it must be an instance of a policy class) use the rules it specifies to update the representation of the message. If policy is not set, use the compat32 policy, which maintains backward compatibility with the Python 3.2 ve

email.parser.BytesFeedParser

class email.parser.BytesFeedParser(_factory=email.message.Message) Works exactly like FeedParser except that the input to the feed() method must be bytes and not string. New in version 3.2.

email.parser.FeedParser

class email.parser.FeedParser(_factory=email.message.Message, *, policy=policy.compat32) Create a FeedParser instance. Optional _factory is a no-argument callable that will be called whenever a new message object is needed. It defaults to the email.message.Message class. If policy is specified (it must be an instance of a policy class) use the rules it specifies to update the representation of the message. If policy is not set, use the compat32 policy, which maintains backward compatibility

email.mime.text.MIMEText

class email.mime.text.MIMEText(_text, _subtype='plain', _charset=None) Module: email.mime.text A subclass of MIMENonMultipart, the MIMEText class is used to create MIME objects of major type text. _text is the string for the payload. _subtype is the minor type and defaults to plain. _charset is the character set of the text and is passed as an argument to the MIMENonMultipart constructor; it defaults to us-ascii if the string contains only ascii code points, and utf-8 otherwise. The _charset

email.mime.multipart.MIMEMultipart

class email.mime.multipart.MIMEMultipart(_subtype='mixed', boundary=None, _subparts=None, **_params) Module: email.mime.multipart A subclass of MIMEBase, this is an intermediate base class for MIME messages that are multipart. Optional _subtype defaults to mixed, but can be used to specify the subtype of the message. A Content-Type header of multipart/_subtype will be added to the message object. A MIME-Version header will also be added. Optional boundary is the multipart boundary string. Wh