also looking at this
Harden encrypted mail storage, recovery, and forwarding
#8
50 files
+1701
-9001
| @@ -0,0 +1,45 @@ | ||
| 1 | # Maildir++ storage | |
| 2 | ||
| 3 | Production mailboxes use Maildir++: | |
| 4 | ||
| 5 | ```text | |
| 6 | mail/<mailbox>/ | |
| 7 | ├── tmp/ | |
| 8 | ├── new/ | |
| 9 | ├── cur/ | |
| 10 | ├── .Junk/ | |
| 11 | │ ├── tmp/ | |
| 12 | │ ├── new/ | |
| 13 | │ └── cur/ | |
| 14 | └── Junk -> .Junk/cur | |
| 15 | ``` | |
| 16 | ||
| 17 | The dot-prefixed directory is the standard Maildir++ representation. The | |
| 18 | visible relative symlink is a compatibility bridge for older server paths and | |
| 19 | is included in IMAP LIST responses. New IMAP folders are created in this form. | |
| 20 | DELETE and RENAME update the canonical directory and compatibility link | |
| 21 | together. | |
| 22 | ||
| 23 | Migrate an existing server with the reusable Buddy operation: | |
| 24 | ||
| 25 | ```bash | |
| 26 | buddy mail:storage:maildir:migrate | |
| 27 | ``` | |
| 28 | ||
| 29 | The migration stops `mail.service`, creates missing `tmp/new/cur` directories, | |
| 30 | moves existing flat-folder messages to `.Folder/cur`, installs relative | |
| 31 | compatibility symlinks, and restarts the service. It is idempotent and refuses | |
| 32 | unexpected symlink targets, filename collisions, and nested legacy folders. | |
| 33 | ||
| 34 | Direct server invocation: | |
| 35 | ||
| 36 | ```bash | |
| 37 | /usr/local/sbin/maildir-migrate status | |
| 38 | /usr/local/sbin/maildir-migrate migrate | |
| 39 | ``` | |
| 40 | ||
| 41 | Backups archive one copy of each folder rather than dereferencing both the | |
| 42 | canonical directory and its compatibility link. | |
| 43 | ||
| 44 | Implementation follow-up is tracked in | |
| 45 | [mail-os/mail#5](https://github.com/mail-os/mail/issues/5). | |