Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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.
share|improve this answer
+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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .