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

Using amavisd-new, I'm successfully marking multiple headers and accurately reporting most spam.

However, right now I'm delivering it to the inbox and I would like to have a Junk folder instead. From time to time I will run sa-learn on these boxes (one for each account). So false negatives could be placed there and the system would learn from that.

I'm not sure if postfix, amavis or policyd is the right place to begin. As I'm using virtual domains, there would be a different folder for each user@domain, and not a general quarantine.

Any thoughts on how to set this up? I guess I want it to function like gmail or yahoo mail do today, automatically moving suspected SPAM into a junk folder.

share|improve this question
up vote 3 down vote accepted

There are several options to accomplish this, and they all largely depend on the delivery agent you are using to do the final delivery to a user's virtual mailbox.

  1. If you are using the stock Postfix virtual(8) delivery agent, you can't accomplish this.
  2. If you are using either the Cyrus LDA or the Dovecot LDA, you habe two more options: You can either use their builtin Sieve functionality (a quick Google search should reveal how to parse the X-Spam-Status header) and provide a global Sieve script or make use of recipient delimiters (set recipient_delimiter = + in Postfix' and have a look at the redirect documentation for amavisd-new).
  3. If you are using maildrop, see James' answer.
  4. If none of this options are applicable, you could let amavisd-new put those mails to a quarantine. OSS quarantine managers are scarce, for SQL based quarantine I do only know of MailZu and MailZu-ng for modern amavisd-new. Maia Mailguard comes with it's own amavisd-new implementation (I don't recommend using Maia for various reasons). Finally, I've lately been writing a combined quarantine/mailsettings management application, but I can't give any dates on when this one will be finished).

A wholly different approach, given that either your mail volume is low or you have access to some serious hardware, would be to run amavisd-new as a before queue filter, thereby eleminating the need for spam/junk folders or quarantine completely: If a legitimate mail is rejected as spam, the sender will be notified by it's own mail server - since you technically never accepted the mail, you won't be responsible for anything.

share|improve this answer
Could I ask why you don't recommend Maia? (I'm a developer for Maia) – DGM Mar 28 '10 at 2:17

You'll need to setup something like procmail or maildrop to filter the mail into the correct folder when it gets delivered.

Using maildrop you can have a default system wide config which will check the headers and filter spam into the correct location, with something like this in /etc/maildroprc:

if (/^X-Spam-Status: yes) {
    to "Maildir/.Spam"

change the mailbox location depending on your local setup.

share|improve this answer

First of all, sorry as this is not a direct answer to your questions, but rather just posting of working spam-proof postfix configuration.

I maintain corporate server, including mail. During last few years I've tried different mail servers, numerous configurations and plugins. So far, the normal number of spam that is being actually delivered to one of the users mailbox is in average 1 per week. Taking into consideration that I have more than a hundred of mailboxes the result is awesome.
Sure, this involves regular checking of mail logs and blocking the IP's of servers that where able to pass postfix, but believe me, I'll better put an IP into the SPAM database manually, than will mess with SPAM filters.

Recently I've posted small article about my AntiSPAM postfix setup in my blog.

My current configuration uses Postfix with postgrey and Dovecot, both using the same PostgreSQL DB.

share|improve this answer

I wouldn't rely 100% on amavisd for dropping mail thought to be spam; I would only mark the subject somehow and still deliver

however, until there, there is greylisting, spf and rbl's which are really great

share|improve this answer

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.