Email and MIME Modules
email.mime
Legacy package of classes for constructing MIME message parts. Specialized subclasses handle text, binary data, embedded messages and multipart containers. Prefer EmailMessage for new applications; MIME headers describe data but do not validate or sanitize it.
Formal Syntax & Structure
python syntaxpython
import email.mimeReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
from email.mime.text import MIMETextpart = MIMEText("hello")print(part.get_content_type())