If policy is specified use the rules it specifies to update and serialize the representation of the message. If policy is not set, use the default policy, which follows the rules of the email RFCs except for line endings (instead of the RFC mandated \r\n, it uses the Python standard \n line endings). For more information see the policy documentation. [2]
If the message is a multipart/alternative, create a new message object, pass all of the arguments to its set_content() method, and attach() it to the multipart.
If the message is a multipart/mixed, create a new message object, pass all of the arguments to its set_content() method, and attach() it to the multipart.
If the message is a multipart/related, create a new message object, pass all of the arguments to its set_content() method, and attach() it to the multipart.
The epilogue attribute acts the same way as the preamble attribute, except that it contains text that appears between the last boundary and the end of the message.
Call the get_content() method of the content_manager, passing self as the message object, and passing along any other arguments or keywords as additional arguments.
Convert a non-multipart or a multipart/related into a multipart/alternative, moving any existing Content- headers and payload into a (new) first part of the multipart.
Convert a non-multipart, a multipart/related, or a multipart-alternative into a multipart/mixed, moving any existing Content- headers and payload into a (new) first part of the multipart.
Convert a non-multipart message into a multipart/related message, moving any existing Content- headers and payload into a (new) first part of the multipart.
Call the set_content() method of the content_manager, passing self as the message object, and passing along any other arguments or keywords as additional arguments.