Skip to main content

📧 CLI to deduplicate mails from mail boxes

Project description

Mail Deduplicate

Last release Python versions Downloads Unittests status Coverage status Documentation status DOI

What is Mail Deduplicate?

Provides the mdedup CLI, an utility to deduplicate mails from a set of boxes.

Mail Deduplicate

Features

  • Duplicate detection based on cherry-picked and normalized mail headers.
  • Fetch mails from multiple sources.
  • Reads and writes to mbox, maildir, babyl, mh, mmdf and eml formats.
  • Deduplication strategies based on size, content, timestamp, file path or random choice, chainable as fallbacks.
  • Copy, move or delete the resulting set of duplicates.
  • Dry-run mode.
  • Protection against false-positives with safety checks on size and content differences.
  • Supports macOS, Linux and Windows.
  • Standalone executables for Linux, macOS and Windows.
  • Shell auto-completion for Bash, Zsh and Fish.

Installation

All installation methods are available in the documentation. Below are the most popular ones:

Try it now

uv is the fastest way to run mdedup on any platform, thanks to its uvx command:

$ uvx --from mail-deduplicate -- mdedup

macOS

mdedup is part of the official Homebrew default tap, so you can install it with:

$ brew install mail-deduplicate

Executables

Standalone binaries of mdedup's latest version are available as direct downloads for several platforms and architectures:

Platform arm64 x86_64
Linux Download mdedup-linux-arm64.bin Download mdedup-linux-x64.bin
macOS Download mdedup-macos-arm64.bin Download mdedup-macos-x64.bin
Windows Download mdedup-windows-arm64.exe Download mdedup-windows-x64.exe

Quickstart

Duplicate mails pile up whenever boxes get copied around: backups of the same account taken at different times, per-folder exports where a mail tagged with several labels lands in several boxes, archives consolidated from multiple clients, or IMAP synchronizations gone wrong.

mdedup cleans this up. Point it at your boxes: it groups copies of the same mail by hashing a curated set of headers, applies a --strategy to pick which copy to keep in each group, then performs an --action on the result. The default action is the safest one: sources are only read, and the deduplicated selection is written to a brand new box.

So to merge two overlapping archives into a single clean box:

$ mdedup --strategy select-one --export merged.mbox archive-2024.mbox archive-2025.mbox

Mails found in both archives are copied once into merged.mbox, along with all the mails that were unique to each source.

To remove duplicates in place instead, switch to a destructive action, and rehearse with --dry-run:

$ mdedup --strategy select-one --action delete-discarded --dry-run ~/Maildir

The hands-on tutorial builds a small playground of duplicated mails, then walks through strategies, actions and safeguards on it. The design page explains how duplicates are detected.

[!WARNING] Performance and memory usage: mdedup implementation is quite naive and everything resides in memory.

If this is good enough for a volume of a couple of gigabytes, the more emails mdedup try to parse, the closer you'll reach the memory limits of your machine. In which case mdedup will exit abruptly, zapped by the OOM killer of your OS. Of course your mileage may vary depending on your hardware.

You can influence implementation of this feature with pull requests, purchasing business support 🤝 and sponsorship 🫶.

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

mail_deduplicate-9.1.0.tar.gz (46.6 kB view details)

Uploaded Source

Built Distribution

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

mail_deduplicate-9.1.0-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file mail_deduplicate-9.1.0.tar.gz.

File metadata

  • Download URL: mail_deduplicate-9.1.0.tar.gz
  • Upload date:
  • Size: 46.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mail_deduplicate-9.1.0.tar.gz
Algorithm Hash digest
SHA256 ea3f91b5576cdea67c40d6842dd1f2ff01beda2430d34b871ff55db73c3ff6c6
MD5 305d2d24c4c35b6c0091b1821d289779
BLAKE2b-256 9776ad61fa37b65047cffbf8196ebf6379e41afbf09304ffa760eda2b6ebda97

See more details on using hashes here.

Provenance

The following attestation bundles were made for mail_deduplicate-9.1.0.tar.gz:

Publisher: release.yaml on kdeldycke/mail-deduplicate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mail_deduplicate-9.1.0-py3-none-any.whl.

File metadata

  • Download URL: mail_deduplicate-9.1.0-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mail_deduplicate-9.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13b2fc65ee5d4269f75ffa019feecc24bd1d908388e9ecd14ba3c2aa8f7755d2
MD5 5d1c0c618e6f2a65b04b065eb94bc8ae
BLAKE2b-256 30141e8359c8abf613ae53cc8887917afa787412d7b32f79182bd8cae03e08ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for mail_deduplicate-9.1.0-py3-none-any.whl:

Publisher: release.yaml on kdeldycke/mail-deduplicate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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