Synchronize an account

$ himalaya account sync [OPTIONS] [ACCOUNT]

Synchronizes folders and emails of the given account (or the default one if omitted) locally, on your filesystem, for an offline usage of the CLI.

Disclaimer: this feature is still in beta, we recommand you to backup your emails before using it. Do not use in production before the final v1.0.0.

Since the v0.7.0, you can synchronize your folders and your emails locally. To enable this feature, add the following entry in the configuration of the account you want to synchronize:

[accounts.example]
sync.enable = true

By default, Himalaya stores your emails at $XDG_DATA_HOME/pimalaya/email/sync/<account-name>-cache using the Maildir++ format. The location can be customized with the sync.dir option:

[accounts.example]
sync.enable = true
sync.dir = "~/.Mail/my-account-name"

Himalaya also stores 2 lightweight Maildir at $XDG_CACHE_HOME/pimalaya/email/sync/<hash> which contains the previous state of every local and remote envelopes. This way Himalaya tries to guess which side (local or remote) needs to be updated. In case of conflict, Himalaya takes the solution that does not loose any data. For instance: if an envelope exists in the local Maildir and in the local cache, but not remotely nor in the remote cache, we cannot determine if an email has been added locally or removed remotely. In this case, Himalaya will consider that the email has been added locally in order not to loose data.

Warning: if you want to restart the synchronization from scratch, make sure to delete all data and cache folders, otherwise Himalaya may consider that emails have been removed locally and needs to be removed remotely, which would lead to a complete wipeout of your data!.

Options

-d|--dry-run

Run the synchronization without applying any changes.

Instead, a report will be printed to stdout containing all the changes the synchronization plan to do.

-F|--include-folder

Synchronize only specific folders (can be repeated).

Only the given folders will be synchronized (including associated envelopes and messages). Useful when you need to speed up the synchronization process. A good usecase is to synchronize only the INBOX in order to quickly check for new messages.

Overrides the config option sync.strategy.

-x|--exclude-folder

Omit specific folders from the synchronization.

The given folders will be excluded from the synchronization (including associated envelopes and messages). Useful when you have heavy folders that you do not want to take care of, or to speed up the synchronization process.

Overrides the config option sync.strategy.

-A|--all-folders

Synchronizes all existing folders.

Settings

sync.enable

Enable the synchronization for the current account.

Enabling the synchronization allows you to run the command account sync <account-name>, which synchronizes all folders and its associated emails to a local Maildir. All other commands also operate on this Maildir backend rather than the default one, which makes your account usable even offline.

sync.enable = true

sync.dir

Customize the root directory where the Maildir cache is saved.

Defaults to $XDG_DATA_HOME/pimalaya/email/sync/<account-name>.

sync.dir = "~/.local/share/himalaya/custom"

folder.sync.filter

Use the given strategy to synchronize folders:

  • folder.sync.filter = "all" (default): Synchronizes all folders.

  • folder.sync.filter.include = ["INBOX", "Sent"]: Synchronizes only folders matching the given names.

  • folder.sync.filter.exclude = ["Trash"]: Synchronizes all folders except the ones matching the given names.