Email and MIME Modules
email.utils
Utilities for formatting and parsing addresses and message dates, and generating message identifiers. Date parsing can return timezone-aware or naive datetimes depending on input. Address parsing is not mailbox verification; use structured headers for new message composition.
Formal Syntax & Structure
python syntaxpython
import email.utilsReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
from email.utils import parsedate_to_datetimevalue = parsedate_to_datetime("Tue, 02 Jan 2024 12:00:00 +0000")print(value.isoformat())