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.FeedParser.feed()

feed(data) Feed the FeedParser some more data. data should be a string containing one or more lines. The lines can be partial and the FeedParser will stitch such partial lines together properly. The lines in the string can have any of the common three line endings, carriage return, newline, or carriage return and newline (they can even be mixed).

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.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.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.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

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.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.nonmultipart.MIMENonMultipart

class email.mime.nonmultipart.MIMENonMultipart Module: email.mime.nonmultipart A subclass of MIMEBase, this is an intermediate base class for MIME messages that are not multipart. The primary purpose of this class is to prevent the use of the attach() method, which only makes sense for multipart messages. If attach() is called, a MultipartConversionError exception is raised.