Skip to main content

imapdiag

Copyright © 2020 Ralph Seichter

Compare message IDs across server pairs to verify replication success. Requires Python 3.7 or newer.

usage: imapdiag [-h] [-c] [-f FILTER] [-m REGEX] [-x REGEX] [-l LEVEL]
                [-s URL] [-u USER] [-p PASSWORD]
                server [server ...]

IMAP server diagnostics

positional arguments:
  server       IMAP server

optional arguments:
  -h, --help   show this help message and exit
  -c           Clear database on startup
  -f FILTER    IMAP search filter (default: UNDELETED)
  -m REGEX     Mailbox include regex (default: ^INBOX$)
  -x REGEX     Mailbox exclude regex (default: see documentation)
  -l LEVEL     Log level (default: DEBUG)
  -s URL       SQLAlchemy database URL (default: sqlite:///:memory:)
  -u USER      User name
  -p PASSWORD  Password

Default installation

python3.7 -m venv venv
source venv/bin/activate
pip install imapdiag

Alternative: Ubuntu 18 LTS without "pip"

Download the source distribution file imapdiag-VERSION.tar.gz from PyPI.org

sudo apt install python3.7 python3.7-venv python3-sqlalchemy sqlite3
tar xzf /path/to/imapdiag-VERSION.tar.gz
cd imapdiag-VERSION
alias imapdiag="PYTHONPATH=. python3.7 -m imapdiag"

Mode of operation

  • If only one server is specified, imapdiag will execute a scan of that server and exit. This can be used for connection testing.

  • If two servers are specified, imapdiag compares message IDs for the specified IMAP account and mailboxes across both servers.

  • If three or more servers are specified, imapdiag will compare message IDs on server1 with server2, then compare server1 with server3, and so forth.

Database configuration

Detailed information about SQLAlchemy URLs and supported database dialects is available here. Imapdiag will attempt to create missing databases and the necessary structure. This usually works well when using SQLite, but may fail with other database types.

Server names and ports

Server names can be specified as fully qualified names or IP addresses. An optional colon and a port number can be added, e.g. imapserver.domain.tld:567. The default is TCP port 993 (imaps).

Argument files

You can specify arguments on the command line and/or in files. The latter can be referenced using the @ character prefix. When using files, argument keys and values must be specified on separate lines:

-s
sqlite:////tmp/imapdiag.db
-l
INFO
-f
UNDELETED SINCE 01-Mar-2020
-p
MASTERPASSWORD
server1.domain.tld
server2.otherdomain.tld

If you choose to save password data in a file, make very sure to restrict access. Specifying passwords on the command line is not a safer option, because other users on the machine may be able to inspect process arguments.

Assuming you have stored this configuration in the file /tmp/args, you can call the utility as follows:

imapdiag @/tmp/args -u janedoe*MASTERUSER

Specifying mailbox names

Exclusion and inclusion of mailbox names is specified using case-insensitive Python 3 regular expressions. Make sure to quote expressions as required by your shell. To include all subscribed mailboxes of an IMAP account, use -m . (a single dot, not an asterisk). The default exclusion RE is this:

(Deleted|Draft|Entw[uü]rf|Gelöscht|Junk|Papierkorb|Spam|Template|Trash|Vorlage)

Note that exclusion has higher priority than inclusion.

Metadata

Release files for imapdiag 0.2

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

Source distribution (sdist)

Source distribution for imapdiag 0.2
File Size Uploaded Provenance
imapdiag-0.2.tar.gz 6.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for imapdiag 0.2
File Interpreter ABI Platform
imapdiag-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / imapdiag-0.2.tar.gz

Download URL imapdiag-0.2.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bc873c022df560ceb217f959495d0d0145f47551f0bb05dd535c6aff15e2e20c
BLAKE2b-256 checksum
How to use checksums
7f89601ba9416ba2811c48e7fee2ba0abfbdfb425f0bd6b26f5a3d8a8ae5edc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

Release files / imapdiag-0.2-py3-none-any.whl

Download URL imapdiag-0.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62e3dd907fc7a022a56450c0bdf728f3883780c567d17406325f38ec48535aa6
BLAKE2b-256 checksum
How to use checksums
9e00bd46f50875132e5b7da445802f99787a83a4715c60e1a344079059c07df6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

Security for imapdiag 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

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