Mutt: Automatically subscribe to IMAP mailboxes

imapmutt

I'm using a bunch of mailboxes in mutt which are populated by imapfilter. To avoid manual reconfiguration (by going to the folder list and pressing s at every new entry), I'd like to configure mutt to simply subscribe to all IMAP folders except sent, trash and postponed on startup. Is this possible without having to generate the configuration file?

Best Answer

The imap_list_subscribed option may give you what you want, albeit in a roundabout way. From the documentation:

This variable configures whether IMAP folder browsing will look for only subscribed folders or all folders. This can be toggled in the IMAP browser with the function.

If set to no (the default), it will not check subscription status and will instead display all folders on the server (all of those returned by a LIST command).

If you're not happy with that and want the folders to be subscribed to as well, a better approach may be to script a CLI tool (much like you use imapfilter). The easiest may be curl, which supports raw IMAP commands. Simply fetch a list of folders (using LIST) and then subscribe to them (SUBSCRIBE).

Related Question