Jon Fullmer wrote:
I'm using Postfix, Amavisd-new/SpamAssassin, and Dovecot. They all run on the same server (running Linux). The mailboxes are stored on the same server in maildir format.
The logical path for incoming messages (as I understand it) is:
- received by Postfix; handed off to Amavisd-new
- Amavisd-new checks to see whether or not it's spam/undesirable; hands off to Dovecot deliver
- Dovecot deliver delivers the message to the local mailbox
Under each of my user's mailbox is a submailbox called "spam". Just so I don't confuse terminologies (I'm no IMAP/maildir expert), for example, we have someone@domain.com. My configured mail_location is "maildir:/srv/mail/%d/%n", so this person's mailbox is located here:
/srv/mail/domain.com/someone/ Within this directory is another mailbox: /srv/mail/domain.com/someone/.spam/[snip]
Or is there a better way?
you can use something like this (in master.cf):
dovecot unix - n n - - pipe flags=DRhu user=_mailbox argv=/path/to/dovecot/deliver -d ${user}@${nexthop} -n -m ${extension}
(-n prevents dovecot from creating the folder if it doesn't exist. otherwise, strangers can create random folders in your mailbox!).
Alternatively, you can use sieve:
require "fileinto";
if header :contains "X-Spam-Flag" "YES" { fileinto "Junk"; stop; }
#if header :contains "X-Amavis-Alert" "BANNED" { # fileinto "Junk"; # stop; #}
#if header :contains "X-Spam-Status" "BOUNCE_MESSAGE" { # fileinto "Junk.Bounce"; # stop; #}
Thanks so much for your help, and thanks for a great product!
- Jon