Skip to main content

A utility to compress email messages for use with dovecot.

Project description

Compress mail

PyPI - Version PyPI - Python Version

blog X (formerly Twitter) Follow

compress-mail is a simple command line tool that is used with Dovecot to compress Maildir format files.


Table of Contents

Introduction

compress-mail is a simple command line tool that is used with Dovecot to compress Maildir format files.

It follows Dovecot best practices, including its own implementation of the maildirlock program, originally written in C and that is buggy. The Dovecot authors suggest using dsync (doveadm sync), but this only does whole mailboxes, not individual folders, and is more time consuming to configure.

compress-mail uses Maildir flags to mark which files have already been compressed, and thus skips them on subsequent runs, so it is safe to run multiple times.

Installation

The recommended way to install compress-mail is to use pipx.

After getting pipx installed, simply run:

pipx install compress-mail

Please don't use pip system-wide.

You can of course also install it using classic virtualenvs.

Usage

Usage help can be obtained by running:

compress-mail --help

Usage: compress-mail [OPTIONS]

Options:
  -b, --basedir TEXT             Base directory containing dovecot-uidlist,
                                 cur, and tmp directories  [required]
  -m, --maildir TEXT             Path to the Maildir (default: basedir/cur/)
  -t, --tmp-dir TEXT             Path to the temporary directory for
                                 compression (default: basedir/tmp/)
  -c, --control-dir TEXT         Path to the control directory containing
                                 dovecot-uidlist (default: basedir)
  --timeout INTEGER              Timeout for maildirlock
  -z, --compression [gzip|zstd]  Compression method to use (gzip or zstd)
  -l, --lock / --no-lock         Use maildir locking mechanism
  --version                      Show the version and exit.
  --help                         Show this message and exit.

So, if you have a normal Maildir structure like the following:

drwx------ 2 user group  2363392 Mar 31 08:42 cur
-rw------- 1 user group   242824 Mar 30 15:41 dovecot.index
-rw------- 1 user group 15596760 Mar 31 08:18 dovecot.index.cache
-rw------- 1 user group    26224 Mar 31 08:42 dovecot.index.log
-rw------- 1 user group       97 Feb 15  2019 dovecot-keywords
-rw------- 1 user group   953295 Mar 31 08:18 dovecot-uidlist
-rw------- 1 user group        0 Mar  2  2011 maildirfolder
drwx------ 2 user group    36864 Mar 31 08:17 new
drwx------ 2 user group   270336 Mar 31 08:18 tmp

.Trash
├── cur
├── new
└── tmp

All you need to do is run:

user@host:~$ compress-mail --basedir .Trash --compression zstd

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

compress_mail-1.0.8.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

compress_mail-1.0.8-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file compress_mail-1.0.8.tar.gz.

File metadata

  • Download URL: compress_mail-1.0.8.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for compress_mail-1.0.8.tar.gz
Algorithm Hash digest
SHA256 2dc8e298dfb98634f933a4d98f08fbe8a199f6bb2b83890f8e67ceca6d7f298f
MD5 643a23642d9b586e18b2c41cef111c39
BLAKE2b-256 12d99cdafbf20b4bf9aa5d9836b5fdb0aaf759daca08897ca758cc8d3fe55fc9

See more details on using hashes here.

File details

Details for the file compress_mail-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for compress_mail-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c40140e3fae0962bd2c3704ffa71729a7ad1eb4597f118974bd73744347ba181
MD5 46ade2695798da047239fdcda0fc951a
BLAKE2b-256 77a348ad89042384f36ca7ee5eaa074b095bb4571efbbb1a42bdad3e6e7db7be

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