Server Fault is a question and answer site for system and network administrators. 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

My mailserver consists of dovecot and postfix.

I am receiving alot of mails from different mailing lists. These mails should directly go into my inbox when they come in, because it is easier to maintain a single inbox for me then multiple ones.

After a time, my inbox is full with all these mailing list mails, which i do not like. I want to have a cronjob which periodically sorts my (read) mailing list mails (filtered by header) into special folders.

What is the easiest way of doing such? Is this possible without requiring additional tools?

I do NOT want to filter mail when it comes in.

Maybe it is possible to use a command-line imap-client to do that?

share|improve this question
up vote 2 down vote accepted

Postfix isn't what you're going to care about: if you're reading the mail in your IMAP spool, local delivery has already happened, Postfix couldn't care less about the messages.

What you want are Dovecot tools to filter mail, either as it comes in from Postfix, or retroactively.

From what you're saying, you want to do it retroactively. In that case, take a look at the Dovecot wiki on refiltering mail:

If, in the future, you want to filter mail as it is being delivered by Postfix to Dovecot, you will want to use Sieve:

share|improve this answer
If i understand the dovecot wiki article correctly, it is re-delivering each email which gets filtered by sieve then. I would rather not like to re-deliver all my emails multiple times a day. – Zulakis Jul 27 '12 at 22:08
@Zulakis no, its filtering the message once as its received. Postfix hands the message to dovecot-lda which invokes the sieve filter to figure out where the mail should go. – Patrick Jul 28 '12 at 17:51
I should also note that maildrop is another very popular utility for doing mail filtering. – Patrick Jul 28 '12 at 17:51
@Patrick This is exactly how it works, yes. Maybe you misunderstood my comment. I am describing the behaviour of this RefilterMail method mentioned by cjc in it. – Zulakis Jul 28 '12 at 22:01

This is not the job of server side software. Your mail client can do this (hopefully). My Thunderbird can. Not periodically though, but while accessing the mails. And this is perfectly good as you don't care about mail sorting unless you really read them.

share|improve this answer
Letting your MUA do that is not a state of the art solution because mail gets accessed from so many different devices today. In my case i got my phone, my laptop, my Computer and at work my webclient. As you can see, a server-side solution is a must-have in this case. – Zulakis Jul 28 '12 at 21:59
Even on the server you should use client tools. So mutt can be an option. And if you can't do it with mailutils ( then you can't do it. – mailq Jul 28 '12 at 22:23
Could you be a bit more specific on what of the tools i should use? – Zulakis Jul 29 '12 at 9:37
The command line interface. As described in the documentation. – mailq Aug 7 '12 at 19:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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