Skip to main content

This package ensures the import of incoming emails into DMS.

Features

  1. fetch waiting emails from IMAP mailbox

  2. parse emails (headers, attachments, …)

  3. generate a PDF email preview

  4. send informations to DMS webservice

  5. mark emails as imported

Usage

To process emails, you can execute

bin/process_mails config.ini

See config.ini file for various parameters.

For usage with Docker, it’s similar to bin/process_mails but you need to build the Docker image first

docker build -t imio.email.dms .
docker run --rm imio.email.dms config.ini

Release

On each commit on this repo, Jenkins will create a new Docker image, push it on imio staging registry and restart staging instance. On each release (new tag with zest.releaser) Jenkins copy latest staging image and push it on prod registry

Errors

In case the importation process fails, the corresponding emails are marked as errors and are not taken into account anymore. An email notification is sent with the problematic email attached. To process them again, you can execute

bin/process_mails config.ini --requeue_errors

Requirements

package wkhtmltopdf

Contribute

License

The project is licensed under the GPLv2.

Contributors

Changelog

0.29.6 (2026-08-05)

  • email2pdf2: Ignored all wkhtmltopdf libpng warning: iCCP: errors. [chris-adam]

  • email2pdf2: Handled TimeoutError and increased external image fetch timeout to 15s. [chris-adam]

  • imio.email.parser: Added TNEF (Outlook rich text) support. [chris-adam]

0.29.5 (2025-10-21)

  • imio.email.parser: Corrected date following timezone. [chris-adam]

0.29.4 (2025-05-16)

  • imio.email.parser: Fixed base64-encoded rfc822 attachment not decoded. [chris-adam]

0.29.3 (2025-03-26)

  • imio.email.parser: Fixed attachment filename parsing. [chris-adam]

0.29.2 (2025-03-12)

  • Improved test coverage. [chris-adam]

  • Decreased pdf attachment compression to improve quality. [chris-adam]

0.29.1 (2025-02-27)

  • imio.email.parser: improved parser.correct_addresses. [sgeulette]

0.29.0 (2025-02-18)

  • Replaced utils.safe_unicode by utils.safe_text. [sgeulette]

  • Added utils.save_attachment function. [sgeulette]

  • Improved utils.get_reduced_size to be more flexible. [sgeulette]

  • Added notification for agent if exception occurs. [chris-adam]

  • Changed options in process_mails to be more flexible. [sgeulette]

  • Resized inline images in email body. [sgeulette,chris-adam]

  • imio.email.parser improvements. [sgeulette]

  • Added main.compress_pdf function to compress pdf attachment. [chris-adam]

  • Added pdbp in buildout and env var to use breakpoint() alone. [sgeulette]

  • Pinned versions. Added dependency. Corrected source. [sgeulette]

0.28.0 (2024-10-07)

  • Improved failed attempt message. [sgeulette]

  • Corrected email parsing with empty body (avoiding AttributeError on is_attachment). [sgeulette]

  • Added test script [sgeulette]

0.27 (2024-08-23)

  • Added post_with_retries function, to handle operational errors and timeout from webservice. 5 tries each 30 seconds. [sgeulette]

  • Added new option mail_id to treat only a specific mail id (in any status). [sgeulette]

  • Improved mark_mail_as_imported [sgeulette]

  • Upgraded mr.developer and reportlab, Blacked files, Code improvements, Corrected main branch name in gha [sgeulette]

0.26 (2023-09-13)

  • Lowercased email addresses in parser. [sgeulette]

0.25 (2023-08-24)

  • Handled “OSError: broken data stream when reading image file” [sgeulette]

  • Set lower smtp sent limit [sgeulette]

0.24 (2023-05-23)

  • Corrected unicode error when creating unsupported email. [sgeulette]

0.23 (2023-05-23)

  • Added email subject in unsupported message. [sgeulette]

  • Added MS Exchange “resent-from” in parser [sgeulette]

0.22 (2023-02-03)

  • Prefixed gotten eml with mailbox login. [sgeulette]

  • Set a size limit to attach the notified email: so the output email can be sent. [sgeulette]

  • Handled an exif parsing error [sgeulette]

  • Renamed filenames in tar when already in [sgeulette]

0.21 (2023-01-25)

  • Changed orientation of image following exif information. [sgeulette]

  • Added pil test script. [sgeulette]

0.20 (2023-01-24)

  • Kept exif information from original resized image. [sgeulette]

0.19 (2022-12-01)

  • Handled specifically IBM Notes forward (parser modification). [sgeulette]

0.18 (2022-11-28)

  • Handled specifically Apple Mail forward with image in content (parser modification). [sgeulette]

0.17 (2022-07-03)

  • Changed process_mails output to filter easierly. [sgeulette]

  • Added new option reset_flags for process_mails to reset all flags of an email id. [sgeulette]

  • Used default policy in parser [sgeulette]

  • Output rfc822 payload in parser [sgeulette]

0.16 (2022-06-07)

  • Used now email2pdf2. [sgeulette]

  • Handled exception when sending notification mail [sgeulette]

0.15 (2022-05-12)

  • Set locale time to avoid UTC time [sgeulette]

0.14 (2022-04-29)

  • Do not mark mail in dev_mode. [sgeulette]

  • Handled image save when quality parameter is not compliant [sgeulette]

  • Avoided error with x-forward [sgeulette]

0.13 (2022-04-19)

  • Retried 5 times to upload when webservice has an unknown response [sgeulette]

  • Handled UnidentifiedImageError when opening image file to resize [sgeulette]

  • Corrected UnicodeEncodeError when sending notification email [sgeulette]

0.12 (2022-03-31)

  • Used correct recipient for ignored mail [sgeulette]

  • Used smtp.send_message to consider bcc [sgeulette]

0.11 (2022-03-14)

  • Corrected false ‘inline’ disposition attachments. [sgeulette]

  • Do not include inline attachments [sgeulette]

  • Reduced image attachments [sgeulette]

  • Improved –list_emails output. [sgeulette]

  • Added dev_mode flag [sgeulette]

0.10 (2022-02-17)

  • Removed newline characters from attachment filename in imio.email.parser. [sgeulette]

0.9 (2022-02-17)

  • Removed pattern in sent email for ignored error. [sgeulette]

  • Corrected badly addresses from email.utils.getAddresses (in imio.email.parser) [sgeulette]

  • Upgraded mail-parser [sgeulette]

0.8 (2022-01-24)

  • Ignored ‘ignored’ flaged mails when getting waiting emails. [sgeulette]

0.7 (2022-01-21)

  • Added transferer check following pattern to avoid anyone can push an email in the app. [sgeulette]

0.6 (2022-01-13)

  • Corrected bug in email2pdf. [sgeulette]

0.5 (2022-01-11)

  • Added –stats option. [sgeulette]

  • Added timeout in email2pdf to avoid wasting time in external image retriever [sgeulette]

0.4 (2021-11-24)

  • Send email notification after clean_mails. [sgeulette]

  • Corrected error in get_eml option. Added save_as_eml function. [sgeulette]

  • Handled pdf conversion error by sending eml file [sgeulette]

  • Set unsupported email in french [sgeulette]

0.3 (2021-07-23)

  • Avoid exception when decoding in get_email [sgeulette]

  • Added script to clean old processed emails. [sgeulette]

  • Changed –list_emails parameter in main script [sgeulette]

0.2 (2021-05-12)

  • Used https in requests urls if port is 443. [sgeulette]

0.1 (2021-05-12)

  • Initial release. [laulaz, sgeulette]

Metadata

Release files for imio.email.dms 0.29.6

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

Source distribution (sdist)

Source distribution for imio.email.dms 0.29.6
File Size Uploaded
imio_email_dms-0.29.6.tar.gz 409.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for imio.email.dms 0.29.6
File Interpreter ABI Platform
imio_email_dms-0.29.6-py3-none-any.whl Python 3 none any Details

Total release size: 816.4 kB

Release files / imio_email_dms-0.29.6.tar.gz

Download URL imio_email_dms-0.29.6.tar.gz
Size 409.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6ba4ea882e19919078eec53df2562e45c1fc1cf62119d3a800ffade94e2a2eaf
BLAKE2b-256 checksum
How to use checksums
695b50c7a48bf072099a656597d511da5866e31e6c139aa8e105690856ab831f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.15

Release files / imio_email_dms-0.29.6-py3-none-any.whl

Download URL imio_email_dms-0.29.6-py3-none-any.whl
Size 406.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a80c00561f755f4d5be37f99a8fc83d3d5fb9e949e3428064270b8f12a940660
BLAKE2b-256 checksum
How to use checksums
84e0fe8b508e3bf4ba0873984c1d37372139ec1843a663f8afbc5c0bf246f600
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.15

Release history Release notifications | RSS feed

This release

0.29.6 This release

2 release files

0.29.5

2 release files

0.29.4

2 release files

0.29.3

2 release files

0.29.2

2 release files

0.29.1

2 release files

0.29.0

2 release files

0.27

2 release files

0.26

1 release file

0.25

1 release file

0.24

1 release file

0.23

1 release file

0.22

1 release file

0.21

1 release file

0.20

1 release file

0.19

1 release file

0.18

1 release file

0.17

1 release file

0.16

1 release file

0.15

1 release file

0.14

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

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