mbsync(1)
okay so bestie, you're reading the mbsync(1) manual page π this is part 1, and we're about to make syncing IMAP4 and Maildir mailboxes make sense, no cap. Let's get into it.
β¨ NAME β¨
mbsync β synchronize IMAP4 and Maildir mailboxes. Periodt. π
π SYNOPSIS π
mbsync [options ...] {{channel[:box[{,|\n}...]]|group} ...|-a}
mbsync --list-stores [options ...] [store ...]
π DESCRIPTION π
So like, mbsync is a command-line app that synchronizes mailboxes. Right now it supports Maildir and IMAP4 mailboxes. New messages, message deletions, and flag changes can be propagated both ways, and you can select the operation set in a super fine-grained way. Slay.
Synchronization is based on unique message identifiers (UIDs), so no identification conflicts can occur (unlike with some other mail synchronizers). On the other hand, mbsync is susceptible to UID validity changes (but it will recover just fine if the change is unfounded). It's giving resilient.
Synchronization state is kept in one local text file per mailbox pair; these files are protected against concurrent mbsync processes. Mailboxes can be safely modified while mbsync operates (see INHERENT PROBLEMS below for a minor exception). Multiple replicas of each mailbox can be maintained. Obsessed with the flexibility, honestly. β¨
π OPTIONS π
-c,--config fileβ read configuration from file. By default, the configuration is read from$XDG_CONFIG_HOME/isyncrc, and if that does not exist,~/.mbsyncrcis tried in turn.$XDG_CONFIG_HOMEdefaults to~/.configif not set. π-a,--allβ select all configured Channels. Any Channel/Group specifications on the command line are ignored. Bye. π-l,--listβ don't synchronize anything, but list all mailboxes in the selected Channels and exit. Just a little peek. π-ls,--list-storesβ don't synchronize anything, but list all mailboxes in the selected Stores and exit. If no Stores are specified, all configured ones are listed. These are raw Store contents, not filtered by any Channel's Patterns. This option may be used to verify each Store's configuration. Vibe check. π¦-C[f][n],--create[-far|-near]β override any Create options from the config file. See below. β¨-R[f][n],--remove[-far|-near]β override any Remove options from the config file. See below. β¨-X[f][n],--expunge[-far|-near]β override any Expunge options from the config file. See below. β¨{-n|-o|-u|-g|-f|-0|-F},{--new|--old|--upgrade|--gone|--flags|--noop|--full}{-L|-H}[n][o][u][g][f], {--pull|--push}[-new|-old|-upgrade|-gone|-flags]β override any Sync options from the config file. See below. π₯-h,--helpβ display a summary of command line options. π-v,--versionβ display version information. β-y,--dry-runβ enter simulation mode: the Channel status is queried and all required operations are determined, but no modifications are actually made to either the mailboxes or the state files. It's giving ghost mode. π»-e,--ext-exitβ return an extended exit code: add 32 or 64 to the code if any modifications were made on the far or near side, respectively; these are not mutually exclusive, so the code may be 96 if changes were both pushed and pulled. An error may be reported at the same time, so the code may be for example 65 if some changes were successfully pulled, while others failed. π-V,--verboseβ enable verbose mode, which displays what is currently happening. Main character energy fr fr. β¨-D[C][d|D][m][M][n|N][s]],--debug[-crash|-driver|-driver-all|-maildir|-main|-net|-net-all|-sync]β enable debugging categories:C,crashβ use built-in crash handlerd,driverβ print driver calls (metadata only)D,driver-allβ print driver calls (including messages)m,maildirβ print maildir debug infoM,mainβ print main debug infon,netβ print network traffic (protocol only)N,net-allβ print network traffic (including payloads)s,syncβ print synchronization debug info All categories except crash implicitly enable verbose mode. Without category specification, all categories except net-all are enabled. π
-q,--quietβ suppress progress counters (this is implicit if stdout is no TTY, or any debugging categories are enabled), notices, and the summary. If specified twice, suppress warning messages as well. π€«
π CONFIGURATION π
The configuration file is mandatory; mbsync will not run without it. Periodt. Lines starting with a hash mark (#) are comments and are ignored entirely. Configuration items are keywords followed by one or more arguments; arguments containing spaces must be enclosed in double quotes ("), and literal double quotes and backslashes (\) must be backslash-escaped. All keywords (including those used as arguments) are case-insensitive. Bash-like home directory expansion using the tilde (~) is supported in all options which represent local paths. The reference point for relative local paths is the configuration file's containing directory. There are a few global options, the others apply to particular sections. Sections begin with a section-starting keyword and are terminated by an empty line or end of file. Every section defines an object with an identifier unique within that object class. π
There are two basic object classes: Stores and Channels. A Store defines a collection of mailboxes; basically a folder, either local or remote. A Channel connects two Stores, describing the way the two are synchronized. There are two auxiliary object classes: Accounts and Groups. An Account describes the connection part of network Stores, so server configurations can be shared between multiple Stores. A Group aggregates multiple Channels to save typing on the command line. We love a shortcut. π¦
File system locations (in particular, Path and Inbox) use the Store's internal path separators, which may be slashes, periods, etc., or even combinations thereof. Mailbox names, OTOH, always use canonical path separators, which are Unix-like forward slashes. Slay. β¨
πΈ All Stores πΈ
These options can be used in all supported Store types. The term "opposite Store" refers to the other Store within a Channel. The special mailbox INBOX exists in every Store; its physical location in the file system is Store type specific. π
Path pathβ the location of the Store in the (server's) file system. If this is no absolute path, the reference point is Store type specific. This string is prepended to the mailbox names addressed in this Store, but is not considered part of them; this is important for Patterns and Create in the Channels section. Note that you must append a slash if you want to specify an entire directory. (Default: none) πMaxSize size[k|m][b]β messages larger than size will have only a small placeholder message propagated into this Store. This is useful for avoiding downloading messages with large attachments unless they are actually needed. To upgrade the placeholder to the full message, it must be flagged, and the Upgrade operation executed. Caveats: Setting a size limit on a Store you never read directly (which is typically the case for servers) is not recommended, as you may never notice that affected messages were not propagated to it. Also, as flagging is (ab-)used to request an upgrade, changes to the message's flagging state will not be propagated in either direction until after the placeholder is upgraded.KandMcan be appended to the size to specify KiBytes resp. MeBytes instead of bytes.Bis accepted but superfluous. If size is0, the maximum message size is unlimited. (Default:0) π¦MapInbox mailboxβ create a virtual mailbox (relative to Path) which aliases the INBOX. Makes sense in conjunction with Patterns in the Channels section, though with a Maildir near side, you probably want to place Inbox under Path instead. This virtual mailbox does not support subfolders. π¦Flatten delimβ flatten the hierarchy within this Store by substituting the canonical hierarchy delimiter/with delim. This can be useful when the MUA used to access the Store provides suboptimal handling of hierarchical mailboxes, as is the case with Mutt. A common choice for the delimiter is.. Note that flattened sub-folders of the INBOX always end up under Path, including the"INBOXdelim"prefix. πTrash mailboxβ specifies a mailbox (relative to Path) to copy deleted messages to prior to expunging. See RECOMMENDATIONS and INHERENT PROBLEMS below. (Default: none) ποΈTrashNewOnly yes|noβ when trashing, copy only not yet propagated messages. This makes sense if the opposite Store has a Trash as well (withTrashNewOnly no). (Default:no) πTrashRemoteNew yes|noβ when expunging the opposite Store, copy not yet propagated messages to this Store's Trash. When using this, the opposite Store does not need an own Trash at all, yet all messages are archived. (Default:no) π
π¦ Maildir Stores π¦
The reference point for relative Paths is the configuration file's containing directory.
As mbsync needs UIDs, but no standardized UID storage scheme exists for Maildir, mbsync supports two schemes, each with its pros and cons. The native scheme is stolen from the latest Maildir patches to c-client and is therefore compatible with pine. The UID validity is stored in a file named .uidvalidity; the UIDs are encoded in the file names of the messages. The alternative scheme is based on the UID mapping used by isync versions 0.8 and 0.9.x. The invariant parts of the file names of the messages are used as keys into a Berkeley database named .isyncuidmap.db, which holds the UID validity as well. The native scheme is faster, more space efficient, endianness independent and "human readable", but will be disrupted if a message is copied from another mailbox without getting a new file name; this would result in duplicated UIDs sooner or later, which in turn results in a UID validity change, making synchronization fail. The alternative scheme would fail if a MUA changed a message's file name in a part mbsync considers invariant; this would be interpreted as a message deletion and a new message, resulting in unnecessary traffic. Mutt is known to work fine with both schemes. Use mdconvert to convert mailboxes from one scheme to the other. π οΈ
MaildirStore nameβ define the Maildir Store name, opening a section for its parameters. πAltMap yes|noβ bestie, this flips on the alternative UID storage scheme for the mailboxes living in this Store π . Here's the tea though: it does NOT touch mailboxes that already have a UID storage scheme β you gotta usemdconvertto change those. Peep RECOMMENDATIONS below for the whole story. (Default:no)Inbox pathβ where your INBOX lives π . This one is not relative toPath, but you're absolutely allowed to tuck the INBOX inside thePathif that's the vibe. (Default:~/Maildir)InfoDelimiter delimβ the character that separates the info field from a message's basename π. The Maildir standard says it should be the colon, but lol, that is incompatible with DOS/Windows file systems. (Default: the value ofFieldDelimiter)SubFolders Verbatim|Maildir++|Legacyβ the on-disk folder naming style for hierarchical mailboxes π³. Heads up: this option does literally nothing whenFlattenis used. So say we've got mailboxes with the canonical pathstop/sub/subsubandINBOX/sub/subsubβ here's what each style spits out on disk:VerbatimβPath/top/sub/subsubandInbox/sub/subsub(this is the style you probably want, no cap)Maildir++βInbox/.top.sub.subsubandInbox/..sub.subsub(this style plays nice with Courier and Dovecot β but note that the mailbox metadata format is not compatible). Also, attempts to setPathin this mode get rejected, periodt.LegacyβPath/top/.sub/.subsubandInbox/.sub/.subsub(this is mbsync's historical style, a true throwback π«Ά)
(Default: unset; it will error out when sub-folders are encountered π)
π¦ IMAP4 ACCOUNTS π¦
IMAPAccount nameβ define the IMAP4 Accountname, which opens up a whole section for its parameters β¨Host hostβ the DNS name or IP address of the IMAP server π. IfTunnelis used, you only need this whenTLSTypeis notNoneandCertificateFileisn't used β in that case the host name gets used for certificate subject verification.Port portβ the TCP port number of the IMAP server π. (Default:143for IMAP,993for IMAPS) IfTunnelis used, this setting is ignored.Timeout timeoutβ the connect and data timeout for the IMAP server, in seconds β±οΈ.Zeromeans unlimited. (Default:20)User usernameβ the login name on the IMAP server π€.UserCmd [+]commandβ give a shell command to fetch a user instead of hardcoding one, so you can script the whole username-retrieval situation π¬. The command must produce exactly one line on stdout; the trailing newline is optional. Slap a+in front of the command to signal that it produces TTY output (like a prompt); forgetting that will merely make your output messier π. And remember to backslash-escape double quotes and backslashes you embed into the command.Pass passwordβ the password forusernameon the IMAP server π. Note that this option is not required. If neither a password nor a password command is specified in the config file, mbsync will just prompt you for one.PassCmd [+]commandβ give a shell command to fetch a password instead of hardcoding one, so you can use password files and agents π΅οΈ. SeeUserCmdabove for the deets.UseKeychain yes|noβ whether to pull the password from the macOS Keychain π. (Default:no)
You can create the keychain item you need like this:
security add-internet-password -r imap -s Host -a User -w password [ -T /path/to/mbsync ]
Tunnel commandβ a command to run to establish the connection instead of opening a TCP socket π. This is how you run an IMAP session over an SSH tunnel, for example.AuthMechs type ...β the list of acceptable authentication mechanisms π. On top of the mechanisms listed in the SASL registry (link below), the legacy IMAPLOGINmechanism is also known. The wildcard*represents all mechanisms deemed secure enough for the currentTLSTypesetting. The mechanism actually used is the most secure choice from the intersection of this list, the list the server supplies, and the installed SASL modules π§ . (Default:*)TLSType {None|STARTTLS|IMAPS}β pick your connection security/encryption method π‘οΈ:Noneβ no security. This is the default whenTunnelis set, since tunnels are usually secure.STARTTLSβ security gets established via the STARTTLS extension after connecting the regular IMAP port143. Most servers support this, so it's the default (unless a tunnel is used).IMAPSβ security gets established by starting TLS negotiation right after connecting the secure IMAP port993.
TLSVersions {+|-}{1.0|1.1|1.2|1.3} ...β add/remove the specified TLS versions to/from the set of acceptable choices π§. Use old versions only when the server has problems with newer ones. Note that new versions are automatically enabled as soon as OpenSSL supports them, even if mbsync doesn't recognize them yet. (Default: All starting with1.2).SystemCertificates yes|noβ whether the system's default CA (certificate authority) certificate store should be used to verify certificate trust chains π. Disable this if you want to trust only hand-picked certificates. (Default:yes)CertificateFile pathβ a file containing additional X.509 certificates used to verify server identities π. It may contain two types of certificates:Hostβ these certificates are matched only against the received server certificate itself. They are always trusted, regardless of validity. A typical use case would be forcing acceptance of an expired certificate. You can grab these with thembsync-getcerttool; make sure to verify their fingerprints before trusting them, or transfer them securely from the server's network (if it can be trusted beyond the server itself) β οΈ.CAβ these certificates are used as trust anchors when building the certificate chain for the received server certificate. They supplant or supersede the system's trust store, depending on theSystemCertificatessetting; it is not necessary and not recommended to specify the system's trust store itself here. The trust chains are fully validated β .
ClientCertificate pathβ a file containing a client certificate to send to the server πͺͺ.ClientKeyshould also be specified. Note that client certificate verification is usually not required, so it's unlikely you need this option.ClientKey pathβ a file containing the private key corresponding toClientCertificateποΈ.CipherString stringβ the OpenSSL cipher string for connections secured with TLS up to version1.2(but not1.3and above) π. The format is described inciphers(1). (Default: empty, which implies system-wide policy)PipelineDepth depthβ the maximum number of IMAP commands that can be simultaneously in flight π. Setting this to1disables pipelining. This is mostly a debugging option, but it can also limit average bandwidth consumption (GMail may require this if you have a very fast connection), or spare flaky servers like M$ Exchange π. (Default: unlimited)DisableExtension[s] extension ...β disable the use of specific IMAP extensions π«. This can be used to work around bugs in servers (and possibly mbsync itself π). (Default: empty)
π IMAP STORES π
The reference point for relative Paths is whatever the server feels like it should be; probably the user's $HOME or $HOME/Mail on that server π‘. The location of INBOX is up to the server too, and it's usually irrelevant.
IMAPStore nameβ define the IMAP4 Storename, opening a section for its parameters β¨Account accountβ which IMAP4 Account to use π. Instead of defining anAccountand referencing it here, you can also just specify all the Account options directly in the Store's section β which makes sense if an Account is only used for one Store anyway.UseNamespace yes|noβ selects whether the server's first "personal"NAMESPACEshould be prefixed to mailbox names π·οΈ. Disabling this makes sense for some broken IMAP servers. This option is meaningless if aPathwas specified. (Default:yes)PathDelimiter delimβ the server's hierarchy delimiter πͺ. (Default: taken from the server's first "personal"NAMESPACE) Do not abuse this to re-interpret the hierarchy. UseFlatteninstead.SubscribedOnly yes|noβ selects whether to synchronize only mailboxes that are subscribed to on the IMAP server π¬. In technical terms, if this option is set, mbsync will use the IMAP commandLSUBinstead ofLISTto look for mailboxes in this Store. This option makes sense only in conjunction withPatterns. (Default:no)
π CHANNELS π
Channel nameβ define the Channelname, opening a section for its parameters β¨{Far|Near} :store:[mailbox]β specify the far resp. near side Store to be connected by this Channel π€οΈ. IfPatternsare specified,mailboxis interpreted as a prefix which is not matched against the patterns, and which is not affected by mailbox list overrides. Otherwise, ifmailboxis omitted,INBOXis assumed.Pattern[s] [!]pattern ...β instead of syncing just one mailbox pair, sync all mailboxes that match the pattern(s) πΈ. The mailbox names are the same on the far and near side. Patterns are IMAP4 patterns, i.e.,*matches anything and%matches anything up to the next hierarchy delimiter. Prepending!to a pattern makes it an exclusion. Multiple patterns can be specified (either by supplying multiple arguments or by usingPatternmultiple times); later matches take precedence π.
Note that INBOX is not matched by wildcards, unless it lives under Path.
The mailbox list selected by Patterns can be overridden by a mailbox list in a Channel reference (a Group specification or the command line).
Example: "Patterns % !Trash"
MaxSize size[k|m][b]β literally the same energy as the option with the same name over in the Stores section, except this one hits Far and Near at the same time. β οΈ Heads up bestie: this actually modifies the Stores, so if you're reusing those Stores across multiple Channels, do not come crying to me when your settings start beefing with each other. Keep them consistent.MaxMessages countβ caps how many messages get to stay in each near side mailbox. Perfect for those mailboxes where you keep the full archive chillin' on the server but you only wanna mirror the last few messages (mailing lists, I'm looking at you π«Ά). The messages that arrived first get deleted first β and no, that has nothing to do with the actual date on the message, it's arrival order, periodt. Messages that are flagged (a.k.a. marked as important) plus β by default β unread messages will not get auto-deleted. Ifcountis0, then the max number of messages is unlimited. (Global default:0).ExpireUnread yes|noβ decides whether unread messages get caught up inMaxMessages. Normally unread messages are treated as important, so they never expire β which is the whole point, you never miss new messages even after ghosting your inbox for like a month. But if your archive is by design stuffed with a huge pile of unread messages, then treating them all as important would basically defeatMaxMessagesentirely π. That's when you flip this on. (Global default:no).ExpireSide Far|Nearβ picks which side gets expired whenMaxMessagesis configured. (Global default:Near).Sync {None|[Pull] [Push] [New] [Old] [Upgrade] [Gone] [Flags] [Full]}β choose which synchronization operation(s) to run:Pullβ propagate changes from far to near side.Pushβ propagate changes from near to far side.Newβ propagate newly appeared messages.Oldβ propagate previously skipped, failed, and expired messages. This one is (relatively) expensive and can repeatedly spit out error messages, so it always has to be specified explicitly. No sneaky defaults here.Upgradeβ upgrade placeholders to full messages. Only useful if you've got aMaxSizeconfigured.Goneβ propagate message disappearances. Only applies to messages that are actually gone, like, expunged gone. The affected messages in the opposite Store just get marked as deleted β meaning they won't really be deleted until that Store gets expunged. π»Flagsβ propagate flag changes. And yes, Deleted/Trashed counts as a flag too, which is extra interesting if you're running mutt with themaildir_trashoption.Fullβ an alias for"New Upgrade Gone Flags". This is the global default, bestie.None(--noopon the command line) β don't propagate anything. Useful if you just wanna expunge and nothing else.
So Pull and Push are direction flags, while New, Old, Upgrade, Gone, and Flags are type flags. These two flag classes make up a whole two-dimensional matrix (a table, yes, we're doing math π
). Its cells are the individual actions to perform. And there are two styles of asserting those cells:
- In the first style, the flags select entire rows/columns of the matrix. Only the cells selected both horizontally and vertically get asserted. Specifying no direction is like specifying both directions, and specifying no type is like specifying
Full. For example,"Sync Pull New Flags"will propagate new messages and flag changes from the far side to the near side,"Sync New Gone"will propagate message arrivals and deletions both ways, and"Sync Push"will propagate all changes from the near side to the far side. - In the second style, direction flags get concatenated with type flags; every compound flag immediately asserts a cell in the matrix. On top of at least one compound flag, the individual flags can be used too β but unlike the first style, they immediately assert all cells in their respective row/column (the one exception being
Old). For example,"Sync PullNew PullGone Push"will propagate message arrivals and deletions from the far side to the near side and any changes (except old messages) from the near side to the far side.
β οΈ Note that it is not allowed to assert a cell in two different ways, e.g."Sync PullNew Pull"and"Sync PullNew Gone Push"will induce error messages. Pick a lane, babe.
None may not be combined with any other operation. At all. Ever.
Create {None|Far|Near|Both}β automatically create missing mailboxes [on the far/near side]. Otherwise mbsync just prints an error message and skips that mailbox pair if a mailbox and the corresponding sync state don't exist. (Global default:None)Remove {None|Far|Near|Both}β propagate mailbox deletions [to the far/near side]. Otherwise it prints an error message and skips that mailbox pair if a mailbox doesn't exist but the corresponding sync state does. For MailDir mailboxes, deleting thecur/subdirectory is enough to mark them as deleted. This keeps things compatible withSyncState *. β¨
Note that for safety, non-empty mailboxes are never deleted. Safety first, always.
(Global default: None)
Expunge {None|Far|Near|Both}β permanently yeet all messages [on the far/near side] that are marked for deletion. Mutually exclusive withExpungeSolofor the same side. See RECOMMENDATIONS below. (Global default:None)ExpungeSolo {None|Far|Near|Both}β permanently removes all messages [on the far/near side] that are both marked for deletion and have no corresponding message in the opposite Store. Together withSync Gone, this lets you actually mirror expunges. But note, it only makes sense if nothing else is expunging the other messages that are marked for deletion. Also note that this doesn't work for IMAP Stores that don't support theUIDPLUSextension π. Mutually exclusive withExpungefor the same side. (Global default:None)CopyArrivalDate {yes|no}β selects whether the messages' arrival time gets propagated along with them. Turning this on makes sense if you wanna keep that time-stamp-based message sorting intact. Note that IMAP does not guarantee the time stamp (which it calls the internal date) is actually the arrival time β but honestly it's usually close enough. (Global default:no)
Sync, Create, Remove, Expunge, ExpungeSolo, MaxMessages, ExpireUnread, ExpireSide, and CopyArrivalDate can all be used before any section for a global effect. Global settings get overridden by Channel-specific options, which in turn get overridden by command line switches. Hierarchy, bestie. π
SyncState {*|path}β sets the location of this Channel's synchronization state files.*means the state should be saved in a file named.mbsyncstatein the near side mailbox itself. The glow-up here: you don't need to handle the state file separately if you delete the mailbox. Downside? It only works with Maildir mailboxes, obviously. π Otherwise, this is interpreted as a string to prepend to the near side mailbox name to build a complete path. Note that you must append a slash if you want to specify a directory. This option can be used outside any section for a global effect. In that case, the appended string is made up according to the pattern:far-store:far-box_:near-store:near-box(see alsoFieldDelimiterbelow). (Global default:$XDG_STATE_HOME/isync/, with a fallback to~/.mbsync/if only that exists.$XDG_STATE_HOMEdefaults to~/.local/stateif it's not set.)
π― Groups
Group name [channel[:box[,...]]] ...β defines the Groupname, opening a section for its parameters. Note that even though Groups have their own namespace, they will "hide" Channels with the same name on the command line. One or more Channels can be specified on the same line. If you supply one or more boxes to a channel, those get used instead of whatever's specified in the Channel'sPatterns. Same deal on the command line, except there newlines can be used as mailbox name separators too. πChannel[s] channel[:box[,...]] ...β adds the specified Channels to the Group. This option can be specified multiple times within a Group.
π Global Options
FSync yes|noβ selects whether mbsync performs forced flushing, which decides your level of data safety after system crashes and power outages β‘. Disabling it is reasonably safe for file systems mounted withdata=orderedmode. Enabling it is a wise choice for file systems mounted withdata=writeback, especially modern ones likeext4,btrfsandxfs. The performance impact on older file systems may be disproportionate. (Default:yes)FieldDelimiter delimβ the character used to delimit fields in the string appended to a globalSyncState. mbsync prefers to use the colon, but that's incompatible with DOS/Windows file systems. This option is meaningless forSyncStateif the latter is*, obviously. However, it also determines the default ofInfoDelimiter. (Global default:;on Windows,:everywhere else)BufferLimit size[k|m][b]β the per-Channel, per-direction instantaneous memory usage above which mbsync will refrain from using more memory. Note that this is not an absolute limit, since even a single message can consume more memory than this. (Default:10M)
π₯οΈ CONSOLE OUTPUT
If mbsync's output is connected to a console, it'll print progress counters by default. The output looks like this:
C: 1/2 B: 3/4 F: +13/13 *23/42 #0/0 -0/0 N: +0/7 *0/0 #0/0 -0/0
This represents the cumulative progress over Channels, boxes, and messages affected on the far and near side, respectively. The message counts represent added messages, messages with updated flags, trashed messages, and expunged messages, respectively. No attempt is made to calculate the totals in advance, so they grow over time as more information gets gathered. It's giving β¨live updatesβ¨.
Irrespective of output redirection, mbsync will print a summary of the above upon completion β except in quiet mode. π€«
π RECOMMENDATIONS π
okay bestie, listen up, these are the little life hacks that make your setup not a mess:
Make sure your IMAP server does not auto-expunge deleted messages β it's slow, and honestly semantically kinda questionable. Specifically, Gmail needs to be configured not to do it. no cap.
By default, mbsync will not delete any messages β expunges are propagated by marking the messages as deleted in the opposite Store. Once you've verified that your setup actually works, you'll typically want to set Expunge to Both, so that deletions become effective. that's the glow-up moment β¨
mbsync's built-in trash functionality relies on mbsync doing the expunging of deleted messages. This is the case when it propagates deletions of previously propagated messages, and the trash is on the target Store (typically your IMAP server).
However, when you intend mbsync to trash messages which were not propagated yet, the MUA must mark the messages as deleted without expunging them (e.g., Mutt's maildir_trash option). Note that most messages are propagated a long time before they are deleted, so this is a corner case you probably do not want to optimize for. This also implies that the TrashNewOnly and TrashRemoteNew options are typically not very useful. like, they're giving "I tried" π
If your server supports auto-trashing (as Gmail does), it is probably a good idea to rely on that instead of mbsync's trash functionality. If you do that, and intend to synchronize the trash like other mailboxes, you should not use mbsync's Trash option at all. periodt.
Use of the Trash option with M$ Exchange 2013 requires the use of DisableExtension MOVE due to a server bug. π
When using the more efficient default UID mapping scheme, it is important that the MUA renames files when moving them between Maildir folders. Mutt always does that, while mu4e needs to be configured to do it:
(setq mu4e-change-filenames-when-moving t)
The general expectation is that a completely new filename is generated as if the message was new, but stripping the ,U=xxx infix is sufficient as well. either way, slay π
πΈ INHERENT PROBLEMS πΈ
ngl, some things are just how they are:
Changes done after mbsync has retrieved the message list will not be synchronised until the next time mbsync is invoked. so yeah, it's not psychic, bestie.
Using Trash on IMAP Stores without the UIDPLUS extension (notably, M$ Exchange up to at least 2010) bears a race condition: messages will be lost if they are marked as deleted after the message list was retrieved but before the mailbox is expunged. There is no risk as long as the IMAP mailbox is accessed by only one client (including mbsync) at a time.
β οΈ messages will be LOST. this is not a drill. one client at a time, or you're risking your mail, fr fr. π
π FILES π
$XDG_CONFIG_HOME/isyncrc(usually~/.config/isyncrc) β Default configuration file. See also the example file in the documentation directory.$XDG_STATE_HOME/isync/(usually~/.local/state/isync/) β Directory containing synchronization state files.~/.mbsyncrcβ Legacy configuration file. the old money version π§~/.mbsync/β Legacy directory containing synchronization state files.
β¨ SEE ALSO β¨
mdconvert(1), mutt(1), maildir(5)
Up to date information on mbsync can be found at http://isync.sf.net/
SASL mechanisms are listed at http://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml
π AUTHORS π
Originally written by Michael R. Elkins, rewritten and currently maintained by Oswald Buddenhagen, contributions by many others; see the AUTHORS file for details. iconic behavior, truly.
and that's the whole page, bestie! this was mbsync from isync 1.5.1, dated 2025-03-11 β go sync those mailboxes, you absolute main character π¦π
π¦ where this page comes from
- alpine 3.24: isync-doc 1.5.1-r1 Β· GPL-3.0-or-later
- fedora 43: isync 1.5.1-2.fc43 Β· GPL-2.0-or-later
- fedora 44: isync 1.5.1-3.fc44 Β· GPL-2.0-or-later
- π the page's license: GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms