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.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.2.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

imio.email.parser-0.2.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: imio_email_parser-0.2.0.tar.gz
  • Upload date:
  • Size: 8.4 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.2.0.tar.gz
Algorithm Hash digest
SHA256 7106b3d30cccb1a732caef9bf84bc6a61b1bbe6c28e56d4c05b1adec1c076ae8
MD5 47d174a20cf489bb6b850a2027e4d533
BLAKE2b-256 d3558eeb2073fcedb5021e399e8b2ab6b637a838bc44485a5c23afbeeb29ff13

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for imio.email.parser-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9a4f095421ee808f4542cb8270a64ec83e36f17dece94957bef8ecca8a84785
MD5 8c67dcbba295f5e557308f53488c65a5
BLAKE2b-256 1fd4f213e3a9bf7929a96f39845479b743250a96a559d5e9d67e7ae8e3cea4f8

See more details on using hashes here.

Supported by

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