Skip to main content

MailKite

MailKite mail-parse (Python)

Streaming, memory-efficient MIME email parser — the Python port of @mailkite/mail-parse.
Same parsed Message shape, and a failure-signature primitive whose hashes match the TypeScript package byte-for-byte.

Docs · Libraries · Node / TypeScript · mailkite.dev

MIT · Python 3.8+

Maintained in the MailKite monorepo; this is the public home for the Python port. The TypeScript package (mail-parse) is the reference implementation.

Why

  • Cross-language SSOT — compute_signature() produces the same failure-signature hash as the TypeScript package for the same failure (conformance-tested against hashes captured from TS).
  • Same Message shape — parse() returns the same structured fields, so payloads are consistent across your stack.
  • Tolerant — malformed input never raises.

Install

pip install mailparse-mailkite

Quickstart

from mailparse import parse, compute_signature

msg = parse(raw_bytes)
msg.from_        # Address(address=..., name=...)
msg.subject
msg.text; msg.html
msg.attachments  # [Attachment(filename, mimeType, content: bytes, size, ...)]

# Deterministic, PII-free fingerprint of a parse failure — identical hash to the TS package.
sig = compute_signature({"scope": "part", "diagnosticCodes": ["UNKNOWN_CHARSET"],
                         "contentType": "text/plain"})
sig["hash"]

Status

The failure-signature primitive is fully ported and cross-language conformance-tested. parse() is built on the stdlib email package (the documented ContentManager precedent) — the buffered path. Porting the streaming splitter + middleware registry to Python is in progress; the TypeScript package is the reference.

Develop

python3 -m unittest discover -s tests

All MailKite libraries

Library Repo Distribution
mail-parse (Node / TypeScript) mail-parse npm
mail-parse (Python) (this repo) mail-parse-py PyPI
MailKite for Python mailkite-python PyPI
MailKite for Node.js mailkite-node npm

Full list: https://mailkite.dev/docs/libraries.

Docs & links

MIT licensed. © MailKite.

Metadata

Release files for mailparse-mailkite 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mailparse-mailkite 0.1.0
File Size Uploaded
mailparse_mailkite-0.1.0.tar.gz 22.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mailparse-mailkite 0.1.0
File Interpreter ABI Platform
mailparse_mailkite-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.9 kB

Release files / mailparse_mailkite-0.1.0.tar.gz

Download URL mailparse_mailkite-0.1.0.tar.gz
Size 22.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7ad25ef56fa8a04b8ea6d046b1eaf27036cfc955269aa5613f0f88738e3793b8
BLAKE2b-256 checksum
How to use checksums
81c80fff8206953ff2f39882d739300838af1100d40e09fa0edfb106a9a73ab9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / mailparse_mailkite-0.1.0-py3-none-any.whl

Download URL mailparse_mailkite-0.1.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76f0972b86cf9a554c7cdec57093d0faf87ad9741ed642fb23c99b396ee21944
BLAKE2b-256 checksum
How to use checksums
f3f101b9d34fd0bcea1c42c5775c279753dbae2b37a7299b9f6428e588fd79ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page