IMAP server diagnostics
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file imapdiag-0.2.tar.gz
.
File metadata
- Download URL: imapdiag-0.2.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc873c022df560ceb217f959495d0d0145f47551f0bb05dd535c6aff15e2e20c |
|
MD5 | 6167dbf0aefa07d04c497b45fc57590a |
|
BLAKE2b-256 | 7f89601ba9416ba2811c48e7fee2ba0abfbdfb425f0bd6b26f5a3d8a8ae5edc7 |
File details
Details for the file imapdiag-0.2-py3-none-any.whl
.
File metadata
- Download URL: imapdiag-0.2-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62e3dd907fc7a022a56450c0bdf728f3883780c567d17406325f38ec48535aa6 |
|
MD5 | 06a97ef9dfe3f8523442a64057a3ee9f |
|
BLAKE2b-256 | 9e00bd46f50875132e5b7da445802f99787a83a4715c60e1a344079059c07df6 |