A doveadm wrapper for common archival tasks.
Project description
dovecot-archive is a doveadm wrapper for common mail archival tasks.
Usage
required arguments:
- --user USER, -u USER
Source user whose mails will be moved.
optional arguments:
- --folder FOLDER, -f FOLDER
Source folder which will be moved including its subfolders. If not given, all user’s folders will be moved
- --dst-user DST_USER, -d DST_USER
Destination user to whom will the mails be moved. If not given, source user will be used.
- --dst-root-folder DST_ROOT_FOLDER, -r DST_ROOT_FOLDER
Destination root folder to move the folder structure into, e.g. ‘Archive’. If not given, root namespace will be used.
- --before BEFORE, -b BEFORE
Move only mails sent before this date. The date needs to supplied as unix timestamp, ISO-8601 (YYY-MM-DD), IMAP4rev1 (DD-Mon-YYYY) or a human readable representation of elapsed time (e.g. “2 months”, “3y”). If not given, all mails will be moved.
- --split-by-year, -y
Create subfolders with the respective years in the destination folder structure as [/dst-root-folder]/<year>/<folder>/<subfolder>. If not given, folders will be moved as a whole.
- --year-as-last-folder, -l
Create subfolders with the respective years as the last folder in the hieararchy as [/dst-root-folder]/<folder>/<subfolder>/<year>. Effective only when –split-by-year is used.
- --copy, -c
Copy the mails instead of moving. If not given the mails are removed from the source location after successful move.
- --namespace-separator, -s
Delimiter character used to separate Dovecot mailbox path components (i.e. not a filesystem directory separator).
- --verbose, -v
Print informational (-v) and debug (-vv) messages. If not given, the tool is silent and outputs only fatal errors.
Use cases
Scenario 1)
I have way too many mails and it makes my e-mail client slow. I want to move sent and received mails older than 3 years to a different user/account (which I only open in my e-mail client when I really need to), and I want to retain the same folder structure of the mailboxes as I have under the current user/account. I don’t want to archive thrash, spam, etc.
Create a weekly cron task:
dovecot-archive --user original.user@example.com --dst-user archival.user@example.com --folder INBOX --folder Sent --before "3 years"
Scenario 2)
I have way too many mails and I want to move mails older than 14 days into an archive folder under the same user/account. I also want to create a subfolder for every year.
Create a daily cron task:
dovecot-archive --user user@example.com --folder INBOX --dst-root-folder Archive --split-by-year --before "14 days"
Scenario 3)
An employee is leaving the company and I want to move all their mail to a new user/account of the employee replacing them. I want to move the whole folder structure, but to place it under a subfolder so it doesn’t interfere with the new empolyee’s mails.
Manually run once:
dovecot-archive --user leaver@example.com --dst-user joiner@example.com --dst-root-folder "Jane Doe"
Changelog
1.1.0
Added --namespace-separator parameter used to separate Dovecot mailbox path components.
1.0.1
Initial release.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dovecot-archive-1.1.0.tar.gz.
File metadata
- Download URL: dovecot-archive-1.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7721d66ab249e389a75818c676deada2f10a87dc628517cc2d92cfcaf38b0cd1
|
|
| MD5 |
e62d0dde8be60a137fbc1952f20a0df3
|
|
| BLAKE2b-256 |
5dc2583af636605e349ebc5297027ad1e34007c3676a5e4592e05158c28de025
|
File details
Details for the file dovecot_archive-1.1.0-py3-none-any.whl.
File metadata
- Download URL: dovecot_archive-1.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce0c939b20fa932e1e94ce90774bf0f4bceebaba360c7c1341b9223101fadd41
|
|
| MD5 |
aaff189b91a5a146118d48c31b19bd73
|
|
| BLAKE2b-256 |
88afbbead719a490a5228e803182b370a358da376ef20c3e7204bdc6d01599ae
|