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.7.tar.gz (7.6 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.7-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for compress_mail-1.0.7.tar.gz
Algorithm Hash digest
SHA256 9093305f9912c2b9999aae48abc665144212c8d2eb919abd38c606472ed83c5e
MD5 f1ffb75195f7c5f272cc370a535f1697
BLAKE2b-256 f978a429dc217f19a081ca562d94dce0058de37a4dda37886472aeaf86c6a98e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for compress_mail-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5854107ad2884c1be7498bf3b9c9273e08b758cfb1916f2e09d4e2aff0936a2d
MD5 86534f70158c7f9a92bc92ec342c02f1
BLAKE2b-256 b1fc0c401182a4845d140f5dbc79461b2de0566ac13f23bcb62ff74feb9e2fea

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