> > [...] The first time you search the bodies of emails in a large imap > > folder it'll take an extremely long time as mutt downloads the bodies > > (including attachments) of all messages in the folder. The next times > > it will be much faster. [...] > > Depends on your IMAP server; some can handle search *server-side*, > which gets rid of the need to “mirror” the message bodies locally. > > Unfortunately, IMAP search only works with substrings, hence won't > handle regular expressions; nonetheless, search with “=b” instead > of “~b” and mutt will automagically switch to server-side search if > possible.
Yes, I'm aware of this but I've found it less reliable than mutt's local search, and behaviour varies from one imap server to another. I feel like if you let mutt do the search yourself, you know what you're getting. > As for your original question, I believe a simpler way to help with IMAP > search speed would involve offlineimap (or similar) that'd mirror your > server locally. Mutt would still need to cache the message bodies but > at least they'd already be stored on your machine, avoiding the server > round-trips involved in a search on a “yet unsearched” folder. Yeah that would work. I'm nervous about using offlineimap though, more than once in the past I've had it go wrong one way or another and suddenly delete an entire folder or account of emails. I've looked for ways to backup my maildirs locally before each time offlineimap is run (e.g. with rsync, rdiff-backup, etc.), but unfortunately maildirs contain thousands of little email files, so any kind of regular incremental backup seems to hammer the CPU and hard drive a lot. I don't know of a good way to do very frequent incremental backups of large maildirs. So these days I connect directly to the imap servers with mutt, which is not ideal. I noticed that offlineimap recently got a one-way sync option that you could use to backup an imap account locally without any risk of erroneously propagating local changes up to the imap server. That may offer some sort of middle ground as you would normally open the imap folders in mutt, but if you wanted to search a big folder you could do the search on the local backup.