I would like to automatically move received messages to list-specific folders on an IMAP server with mutt. All these lists are lists known to mutt.

What I do right now is periodically tag messages by Sender and then tag-save them to the right folder. Mutt already suggests the correct folder. This seems way too pedestrian to me, and I feel there should be some way to automate this.

I know there are specific tools available to do this outside of a MUA, but the only ways to access this server seems to be trough some MUA (e.g. I don't have shell access).

How would I best do this inside mutt?

  • The claws-mail MUA can do that easily, but that's a GUI app. – Keith Feb 16 '11 at 21:25

mutt is an interactive MUA, without automatic filtering capabilities. Your best choice would be to find (or write) a scriptable IMAP client.

Sometimes mail servers also have a web interface with filter editing features, or the ManageSieve protocol.

Or, very ugly but doable:

  • grab messages to your own computer using fetchmail/getmail/offlineimap
  • filter through procmail/maildrop/sieve
  • store on your own IMAP server, or upload back using offlineimap.
  • +1 for mentioning to check any available web interfaces. server side IMAP filtering >> client-side IMAP filtering – afrazier Feb 16 '11 at 19:22
  • Thanks for this answer, but I have to say it doesn't help me at all. If anything I will end up writing a keyboard macro to do this in mutt. – Benjamin Bannier Feb 17 '11 at 0:20

You can use imapfilter to do just that. From the documentation:

IMAPFilter is a mail filtering utility. It connects to remote mail servers using the Internet Message Access Protocol (IMAP), sends searching queries to the server and processes mailboxes based on the results. It can be used to delete, copy, move, flag, etc. messages residing in mailboxes at the same or different mail servers. The 4rev1 and 4 versions of the IMAP protocol are supported.

IMAPFilter uses the Lua programming language as a configuration and extension language.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.