Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

fast_mail_parser

Test PyPI version Downloads

📦 Now published as fast-mail-parser-ng

Install it under the new name:

pip install fast-mail-parser-ng

Your code does not change. The import path is still fast_mail_parser:

from fast_mail_parser import parse_email

Migrating from fast-mail-parser? Change the name in your requirements file and nothing else — no code edits, same API.

- fast-mail-parser
+ fast-mail-parser-ng

Looking for the old fast-mail-parser package? It is a different, unmaintained upload frozen at 0.2.5 (June 2022) that this project cannot publish to. See Why the name changed.

A very fast Python library for parsing .eml files. It is built on the Rust mailparse crate via pyo3, and parses roughly 7–8x faster than pure-Python implementations.

Quickstart

pip install fast-mail-parser-ng
from fast_mail_parser import parse_email

with open("message.eml", "rb") as f:
    email = parse_email(f.read())

print(email.subject)
print(email.text_plain[0])

That is the whole surface for the common case. See Usage for the full API, and Python support for wheel coverage.

Why the name changed

The fast-mail-parser name on PyPI belongs to a PyPI account this project no longer controls, and it is frozen at an unmaintained 0.2.5 from June 2022. Only a project owner can publish to a name, so fixes could not reach it — the PEP 541 transfer request (pypi/support#11044) has been open and unattended since June 2026.

Rather than hold releases behind that queue indefinitely, this project publishes under a name it owns. The import path was deliberately left as fast_mail_parser so the change costs you one line in a requirements file and no code. If the transfer is ever granted, fast-mail-parser will resume as an alias.

Full history in the changelog.

Python support

Wheels target the CPython stable ABI (cp311-abi3): one wheel per platform covers every supported CPython version, including versions released after the package — a new Python no longer has to wait for a new release.

Python Support
CPython 3.11+ (including future versions) Prebuilt wheel
CPython 3.13t/3.14t (free-threaded) Builds from source; the extension currently re-enables the GIL on import (#101)
CPython ≤ 3.10 Not supported (last compatible release: 0.2.5)
PyPy Not supported

13 prebuilt wheels ship per release: manylinux and musllinux across x86_64, i686, aarch64, armv7, s390x and ppc64le; Windows x64 and x86; macOS arm64. Every release is published via PyPI Trusted Publishing with PEP 740 attestations.

Benchmark

Parsing the same message, fast_mail_parser against the pure-Python mail-parser. CI enforces a floor of 7x on every pull request, so this margin is a gate rather than a claim.

 -------------------------------------------------------------------------------------------- benchmark: 2 tests -------------------------------------------------------------------------------------------
Name (time in ms)                              Min                Max               Mean            StdDev             Median               IQR            Outliers       OPS            Rounds  Iterations
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test__fast_mail_parser___parse_message      1.8136 (1.0)       1.8938 (1.0)       1.8426 (1.0)      0.0176 (1.0)       1.8465 (1.0)      0.0277 (1.0)         180;0  542.7141 (1.0)         450           1
test__mail_parser___parse_message          14.5583 (8.03)     15.8571 (8.37)     15.0264 (8.16)     0.2368 (13.49)    14.9702 (8.11)     0.2887 (10.42)         5;1   66.5495 (0.12)         32           1
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

Usage

parse_email accepts the raw message as str or bytes and returns a PyMail. It raises ParseError if the payload cannot be parsed.

PyMail exposes the following attributes:

Attribute Type Description
subject str Subject header (empty string if missing).
date str Date header (empty string if missing).
text_plain list[str] All text/plain bodies.
text_html list[str] All text/html bodies.
headers dict[str, str] All message headers.
attachments list[PyAttachment] Attachments (see below).

Each PyAttachment has mimetype: str, filename: str, and content: bytes.

import sys

from fast_mail_parser import parse_email, ParseError

# parse_email accepts both str and bytes; reading in binary mode is safest.
with open('message.eml', 'rb') as f:
    message_payload = f.read()

try:
    email = parse_email(message_payload)
except ParseError as e:
    print("Failed to parse email:", e)
    sys.exit(1)

print("Subject:", email.subject)
print("Date:", email.date)

# headers is a dict[str, str].
for name, value in email.headers.items():
    print(f"{name}: {value}")

# text_plain and text_html are lists of strings (one entry per matching part).
for body in email.text_plain:
    print("Plain text body:", body)

for body in email.text_html:
    print("HTML body:", body)

# attachments is a list of PyAttachment objects.
for attachment in email.attachments:
    print("Attachment:", attachment.filename)
    print("  mimetype:", attachment.mimetype)
    print("  size:", len(attachment.content), "bytes")  # content is bytes

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

See CONTRIBUTING.md for how to build from source, run the tests, and the PR conventions (linting, CI, DCO sign-off).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_mail_parser_ng-0.6.1.tar.gz (600.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fast_mail_parser_ng-0.6.1-cp311-abi3-win_amd64.whl (327.5 kB view details)

Uploaded CPython 3.11+Windows x86-64

fast_mail_parser_ng-0.6.1-cp311-abi3-win32.whl (316.1 kB view details)

Uploaded CPython 3.11+Windows x86

fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_x86_64.whl (656.8 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ x86-64

fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_i686.whl (681.1 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ i686

fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_armv7l.whl (728.5 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARMv7l

fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_aarch64.whl (621.6 kB view details)

Uploaded CPython 3.11+musllinux: musl 1.2+ ARM64

fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (446.1 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (475.8 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ s390x

fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (476.9 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ppc64le

fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (452.6 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARMv7l

fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (443.2 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl (464.4 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.5+ i686

fast_mail_parser_ng-0.6.1-cp311-abi3-macosx_11_0_arm64.whl (418.0 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

File details

Details for the file fast_mail_parser_ng-0.6.1.tar.gz.

File metadata

  • Download URL: fast_mail_parser_ng-0.6.1.tar.gz
  • Upload date:
  • Size: 600.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for fast_mail_parser_ng-0.6.1.tar.gz
Algorithm Hash digest
SHA256 2fc81aa6a3253bcfd6b8e4a05e70fc4ede857c8f4cb366edba31b7e498119e8d
MD5 4dd4d1f76d979a8a65aabb464e314f36
BLAKE2b-256 14e4edc82994b463da3f319374942c2417c011fade333af6d22619da94ed7926

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1.tar.gz:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b57c8420400f440cb9b68af4f6ba6783ea589f0263391d9787b9446a47073d72
MD5 740948c7ebbd46171d9c60575cb20613
BLAKE2b-256 361b202fabfb35fd0bcbaf4ca8b5f1f5293afcf87a9539dab5ed5cd1ee8de594

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-win_amd64.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-win32.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-win32.whl
Algorithm Hash digest
SHA256 2855b111fb08dcba71ffb1c905148af51df2a538c8aa470ff4cf81d58e717792
MD5 61f046e9b31c79b2a53332be2ca0406e
BLAKE2b-256 58c432a1745badf633a9de72164ac49f64945f82e38e1da051e0e849a7140c60

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-win32.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 80fdd87e177b3e940c8b849e1bca810d8d879a28b6a6c633d6d6f7625e1ea86c
MD5 cefcea3a4b646253ef78054c54ccefa9
BLAKE2b-256 4973e9ed054953d3e3af73e34877e303bd622ace783e04b9f868978da8c6ecce

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_x86_64.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 b2783e68549a8bfa779afcf6dcbb9109a57f15c1b23e58cdb2152a6eb960d851
MD5 7341eaf3e95e405aabe5d582cfa1271e
BLAKE2b-256 42411f7163633ed52a9882f901c401b75f5b79d99b4c10b54ff3451a796f26d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_i686.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 a138c187c399f70aa181489213075ad5540354b9938548d887851ba48ba101f5
MD5 b4dc0bd1e7d5cf72d7c6be818fc214b8
BLAKE2b-256 3a78473044336b46583e1ac1e6dd997170050fffcaaec97893d9330c3688c912

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_armv7l.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 edf399ea430888058e20007ee8d8433885c2880a1b656d98514b3ff3f8011ad1
MD5 0112e7bbc945a2d99f624c3484dd2a81
BLAKE2b-256 650d9f7592926e437cf8bdc6b0eff074aefce1a2f09aa77c55b71ed634466bc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-musllinux_1_2_aarch64.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4be5636f45e1d76e6974140ba6fd9a72ef8ef573d905f3f5a011f0bac1de63a9
MD5 49c72d1494f8dc561f9133b520d526cb
BLAKE2b-256 446abf4e7e0935a74c7ba50e89c82fbd1bf621b1cb034a40557ee214ac35f976

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 2f77ed26015edc5217ff708de6bb42bb25f89b6040e93489ad93ad4a804197a8
MD5 d49e9d612c71364912c3c5639cea2ed2
BLAKE2b-256 4492f2d5beba6baac135c45d0ff99cc1fd7341903f1a6eabbced64ef67255047

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 d9f96c9f0344586d82b072550d42f82ebeda47cbfce2aac8ad2b24326d9761ef
MD5 2211fc0c1dc99adc4d8b1b00671824e4
BLAKE2b-256 cf86bc716d6bf743c04ae9d572e5dbfe6040cb3655b8ad11c857eaa71f168682

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 4d981d6bebacf27be20c9cd087df6d5ccce8a9897f277b40629749197446b3d0
MD5 8213adb1725fc1575dded435217f9f01
BLAKE2b-256 8c4b698e8545cc4950d43f70d9dc8dacd77eeeabe7be648f2d342332d9f1e8ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e94b9883e506349b385d4130a29c3012f22b6d2abace09726b12971bbbcd6971
MD5 1d896d8dd6a23622817b0ea32e71ba8c
BLAKE2b-256 47fb028e6e69b7d6efa31da520e80cfaeb3bbc933c66397e93f7ce1a1e835fe6

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 eb3c700611b37865a770ffdbe7ba09a9304bc7fa71b234c7ab1d60c6226e7ffc
MD5 b01df14a48426aafa0b61a9ae2bda056
BLAKE2b-256 1d917dac7bac472a75ad3c0a94345db4a04fbe7fe570b579ef93aac19b0bc396

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-manylinux_2_5_i686.manylinux1_i686.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fast_mail_parser_ng-0.6.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fast_mail_parser_ng-0.6.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4231a4347bf04a21ca615509f57312fadccedb0ffd31605c2b81d7ed30e267cd
MD5 b39164819af4a205936b81678fa6f529
BLAKE2b-256 027fa12180021806dd1f8f38f7b9f2b9ebfe4dbf11c31663e0c29b9fa48435f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fast_mail_parser_ng-0.6.1-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on namecheap/fast_mail_parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.6.1 This release

14 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