Skip to main content

This parser extracts forwarded attached email, embedded images and attachments. It also generates a PDF from the email.

Project description

This package can parse emails and generate a PDF file of their content.

It is mainly used by package imio.email.dms.

Features

  1. select relevant email messages (e.g. email forwarded as an attachment)

  2. parse emails (headers, attachments, …)

  3. generate a PDF email preview with email2pdf package

Usage

mail = email.message_from_string(mail_body)
parser = Parser(mail)
print(parser.headers)
print(parser.attachments)
parser.generate_pdf(pdf_path)

Requirements

package wkhtmltopdf

Contribute

License

The project is licensed under the GPLv2.

Contributors

Changelog

0.3.3 (2025-07-01)

  • Formatted Date header following timezone. [chris-adam]

0.3.2 (2025-05-16)

  • Fixed base64-encoded rfc822 attachment not decoded. [chris-adam]

0.3.1 (2025-03-26)

  • Improved parser.correct_addresses. [sgeulette]

  • Increased test coverage. [cadam]

  • Fixed attachment filename parsing. [cadam]

0.3.0 (2025-02-18)

  • Used standard email parser in tests. [sgeulette]

  • Handled correctly rfc822 attachment (attached eml) [sgeulette]

  • Handled correctly owa transfer [sgeulette]

  • Added message parameter to parser.generate_pdf [sgeulette]

  • Handled quoted-printable filename [sgeulette]

0.2.0 (2024-10-04)

  • Removed newline characters from attachement filename causing exception when creating file later in Plone. [sgeulette]

  • Added attachments information [sgeulette]

  • Corrected attachments disposition (check really embedded content ids) [sgeulette]

  • Worked with EmailMessage [sgeulette]

  • Added specific handling for Apple Mail forward [sgeulette]

  • Added specific handling for IBM Notes forward [sgeulette]

  • Added specific handling for automatic exchange forward [sgeulette]

  • Get lowercased email addresses [sgeulette]

  • Blacked and isorted files [sgeulette]

  • Corrected body add when missing and worked on a copy of the message in that part [sgeulette]

0.1 (2022-02-17)

  • Corrected badly addresses from email.utils.getAddresses

  • Managed email2pdf exception when email body is empty

  • Added tests

  • Added headers in pdf

  • Added emailtopdf script to test easily eml transformation in pdf

  • Initial release. [laulaz, sgeulette]

Project details


Download files

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

Source Distribution

imio_email_parser-0.3.3.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

imio.email.parser-0.3.3-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file imio_email_parser-0.3.3.tar.gz.

File metadata

  • Download URL: imio_email_parser-0.3.3.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for imio_email_parser-0.3.3.tar.gz
Algorithm Hash digest
SHA256 7906519ed98c9675226b038d066096f92e55bc4b7236fe5d00b09cd5d227eac0
MD5 c894b188a78fb0757800517081dd9b68
BLAKE2b-256 8abf7a6751e6ee2bbcc56bd86af942bbf430e50a11a05459d4e27d812db58d26

See more details on using hashes here.

File details

Details for the file imio.email.parser-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for imio.email.parser-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9208243c13df328e4715caf05752689b5da4ddfa554b8876773857daabfd3edd
MD5 48cb14fa0073a90f8e5c4bc39d41a2b1
BLAKE2b-256 d6dd9a70246a169ac95f10dc7f0fc585d19a4218e984bf2acf6f862269c3823f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page