Provides pure functions for parsing IMAP data, decoding headers, and extracting email bodies. Use this for building custom email clients or automated mail processing services.
# Source: https://github.com/EverMind-AI/Raven | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""Pure parsing helpers for the email adapter.
IMAP date formatting, fetch-tuple extraction, RFC 2047 header decoding, body
text extraction, reply-subject derivation, and raw-bytes -> inbound-dict
assembly. No I/O — unit-tested directly. IMAP/SMTP transport lives in
:mod:`.mailbox`.
"""
from __future__ import annotations
import html
import re
from datetime import date
from email import policy
from email.header import decode_header, make_header
from email.parser import BytesParser
from email.utils import parseaddr
from typing import Any
_IMAP_MONTHS = ("Jan", "Feb", "Mar", "Apr", "May"
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key