Email Articles

email.charset: Representing character sets

Source code: Lib/email/charset.py

email.contentmanager: Managing MIME Content

Source code: Lib/email/contentmanager.py

email.encoders: Encoders

Source code: Lib/email/encoders.py

email.errors: Exception and Defect classes

Source code: Lib/email/errors.py

email.generator: Generating MIME documents

Source code: Lib/email/generator.py

email.header: Internationalized headers

Source code: Lib/email/header.py

email.headerregistry: Custom Header Objects

Source code: Lib/email/headerregistry.py

email.iterators: Iterators

Source code: Lib/email/iterators.py

email.message.Message: Representing an email message using the compat32 API

The Message class is very similar to the EmailMessage class, without the methods added by that class, and with the default behavior of certain other methods being slightly different. We also document here some methods that, while supported by the EmailMessage class, are not recommended unless you are dealing with legacy code.

email.message: Representing an email message

Source code: Lib/email/message.py

email.mime: Creating email and MIME objects from scratch

Source code: Lib/email/mime/

email.parser: Parsing email messages

Source code: Lib/email/parser.py

email.policy: Policy Objects

Source code: Lib/email/policy.py

email.utils: Miscellaneous utilities

Source code: Lib/email/utils.py

email: Examples

Here are a few examples of how to use the email package to read, write, and send simple email messages, as well as more complex MIME messages.