[GH-ISSUE #49] [Enhancement] Export database format #47

Closed
opened 2026-03-03 01:19:22 +03:00 by kerem · 5 comments
Owner

Originally created by @Kabouik on GitHub (Jul 16, 2020).
Original GitHub issue: https://github.com/d99kris/nmail/issues/49

Originally assigned to: @d99kris on GitHub.

I tend to dislike deleting my emails from server, as having an online copy makes my email database agnostic to the machine I'm currently using. However, this is not great for security reasons, ecological reasons, and time will come when I fill all server space I'm allowed to use with my different email providers anyway.

nmail stores emails in a human readable (unless encrypted, of course) cache structure, which I like, but I wonder how standard this format is. If you decide in 5 years to discard all vowels from your email client because reasons, and I find this decision is not great for my use so I want another client, can I reimport the local email cache to most other clients?

If not, while keeping the current cache architecture, would it make sense to add an nmail -d /path/to/confdir --archive-local-cache /path/to/archive command line option? I'm not familiar with what are the available format standards. I just remotely heard about mbox when I was using mailpile (which I still like by the way), but I didn't really master the workflow.

Perhaps there are already standalone tools for that that would be compatible with the nmail cache structure, in which case just a wiki entry would be great.

Originally created by @Kabouik on GitHub (Jul 16, 2020). Original GitHub issue: https://github.com/d99kris/nmail/issues/49 Originally assigned to: @d99kris on GitHub. I tend to dislike deleting my emails from server, as having an online copy makes my email database agnostic to the machine I'm currently using. However, this is not great for security reasons, ecological reasons, and time will come when I fill all server space I'm allowed to use with my different email providers anyway. `nmail` stores emails in a human readable (unless encrypted, of course) cache structure, which I like, but I wonder how standard this format is. If you decide in 5 years to discard all vowels from your email client because reasons, and I find this decision is not great for my use so I want another client, can I reimport the local email cache to most other clients? If not, while keeping the current cache architecture, would it make sense to add an `nmail -d /path/to/confdir --archive-local-cache /path/to/archive` command line option? I'm not familiar with what are the available format standards. I just remotely heard about mbox when I was using `mailpile` (which I still like by the way), but I didn't really master the workflow. Perhaps there are already standalone tools for that that would be compatible with the `nmail` cache structure, in which case just a wiki entry would be great.
kerem closed this issue 2026-03-03 01:19:22 +03:00
Author
Owner

@d99kris commented on GitHub (Aug 2, 2020):

The email message cache format used by nmail is fairly portable. If I simply open a cached .eml file from nmail on my system, Thunderbird opens the cached email and shows it correctly.

However, it's probably not a single step to move an entire cached mailbox from nmail into another email client. It could be worth investigating and supporting this, either with a built-in functionality or as a standalone migration shell-script (or possibly just documentation if it's very simple).

Just one note regarding this:

However, this is not great for security reasons, ecological reasons, and time will come when I fill all server space I'm allowed to use with my different email providers anyway.

nmail currently only supports the IMAP protocol and mirroring a server-side folder structure. nmail does not support local / offline-only folders. So it does not currently provide means to move messages from server to local storage. I am not very inclined to support local-only folders, as it potentially comes with more complex user operation, but it can be suggested and discussed of course.

<!-- gh-comment-id:667666245 --> @d99kris commented on GitHub (Aug 2, 2020): The **email message** cache format used by `nmail` is fairly portable. If I simply `open` a cached `.eml` file from `nmail` on my system, Thunderbird opens the cached email and shows it correctly. However, it's probably not a single step to move an entire cached mailbox from `nmail` into another email client. It could be worth investigating and supporting this, either with a built-in functionality or as a standalone migration shell-script (or possibly just documentation if it's very simple). Just one note regarding this: > However, this is not great for security reasons, ecological reasons, and time will come when I fill all server space I'm allowed to use with my different email providers anyway. `nmail` currently only supports the IMAP protocol and mirroring a server-side folder structure. `nmail` does not support local / offline-only folders. So it does not currently provide means to **move** messages from server to local storage. I am not very inclined to support local-only folders, as it potentially comes with more complex user operation, but it can be suggested and discussed of course.
Author
Owner

@Kabouik commented on GitHub (Aug 4, 2020):

The email message cache format used by nmail is fairly portable. If I simply open a cached .eml file from nmail on my system, Thunderbird opens the cached email and shows it correctly.

However, it's probably not a single step to move an entire cached mailbox from nmail into another email client. It could be worth investigating and supporting this, either with a built-in functionality or as a standalone migration shell-script (or possibly just documentation if it's very simple).

All three options look good to me.

Just one note regarding this:

However, this is not great for security reasons, ecological reasons, and time will come when I fill all server space I'm allowed to use with my different email providers anyway.

nmail currently only supports the IMAP protocol and mirroring a server-side folder structure. nmail does not support local / offline-only folders. So it does not currently provide means to move messages from server to local storage. I am not very inclined to support local-only folders, as it potentially comes with more complex user operation, but it can be suggested and discussed of course.

Good to know, thank you for the clarification. As long as it is documented (so that people don't delete from server and then expect nmail to support offline-only folders) and the email archives can be accessed in other clients easily, that's perfectly fine. It would work only as archiving old emails, not really to continuously clean the server and keep it empty at all times, but that's still useful.

<!-- gh-comment-id:668565355 --> @Kabouik commented on GitHub (Aug 4, 2020): > The **email message** cache format used by `nmail` is fairly portable. If I simply `open` a cached `.eml` file from `nmail` on my system, Thunderbird opens the cached email and shows it correctly. > > However, it's probably not a single step to move an entire cached mailbox from `nmail` into another email client. It could be worth investigating and supporting this, either with a built-in functionality or as a standalone migration shell-script (or possibly just documentation if it's very simple). All three options look good to me. > Just one note regarding this: > > > However, this is not great for security reasons, ecological reasons, and time will come when I fill all server space I'm allowed to use with my different email providers anyway. > > `nmail` currently only supports the IMAP protocol and mirroring a server-side folder structure. `nmail` does not support local / offline-only folders. So it does not currently provide means to **move** messages from server to local storage. I am not very inclined to support local-only folders, as it potentially comes with more complex user operation, but it can be suggested and discussed of course. Good to know, thank you for the clarification. As long as it is documented (so that people don't delete from server and then expect `nmail` to support offline-only folders) and the email archives can be accessed in other clients easily, that's perfectly fine. It would work only as archiving old emails, not really to continuously clean the server and keep it empty at all times, but that's still useful.
Author
Owner

@d99kris commented on GitHub (Jan 12, 2021):

Support for this has been documented / implemented in above commit. Refer to the following README section for documentation https://github.com/d99kris/nmail#accessing-email-cache-using-other-email-clients

<!-- gh-comment-id:758615003 --> @d99kris commented on GitHub (Jan 12, 2021): Support for this has been documented / implemented in above commit. Refer to the following README section for documentation https://github.com/d99kris/nmail#accessing-email-cache-using-other-email-clients
Author
Owner

@Kabouik commented on GitHub (Jan 15, 2021):

Perfect, thank you @d99kris. All my accounts are currently encrypting emails so I cannot try right now, but I will definitely use it for archive purposes.

I'll see if I can combine it with openssl enc -d -aes-256-cbc -md sha1 -in /path/to/eml to first script decryption of all .eml and /hdr files in imap/ and then run the maildir script. Else I may just disable encryption temporarily to do a full scan, use the maildir script, encrypt the output maildir in a different way for archiving, and restore encryption in my nmail configuration and do a full scan again.

<!-- gh-comment-id:760575599 --> @Kabouik commented on GitHub (Jan 15, 2021): Perfect, thank you @d99kris. All my accounts are currently encrypting emails so I cannot try right now, but I will definitely use it for archive purposes. I'll see if I can combine it with `openssl enc -d -aes-256-cbc -md sha1 -in /path/to/eml` to first script decryption of all .eml and /hdr files in `imap/` and then run the maildir script. Else I may just disable encryption temporarily to do a full scan, use the maildir script, encrypt the output maildir in a different way for archiving, and restore encryption in my nmail configuration and do a full scan again.
Author
Owner

@d99kris commented on GitHub (Jan 15, 2021):

Yes it should be possible to extend the script to handle decryption. There's one problem though, the folder names (in the file system) are SHA256 hashes of the original folder names. But if you decrypt ~/.nmail/cache/imap/folders you'll get a list of the folder names, and can then calculate SHA256 hashes for each to determine which one they map to.

We can consider using folder name encryption instead of hashing perhaps for the future. To make it easier to decrypt. Only issue is that the file system folder name become very long.

<!-- gh-comment-id:760952977 --> @d99kris commented on GitHub (Jan 15, 2021): Yes it should be possible to extend the script to handle decryption. There's one problem though, the folder names (in the file system) are SHA256 hashes of the original folder names. But if you decrypt `~/.nmail/cache/imap/folders` you'll get a list of the folder names, and can then calculate SHA256 hashes for each to determine which one they map to. We can consider using folder name encryption instead of hashing perhaps for the future. To make it easier to decrypt. Only issue is that the file system folder name become very long.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nmail#47
No description provided.