I use Courier-IMAP and LDAP to provide virtual e-mail accounts: users
do not have home directories; there is a
/var/imap/${domain}/${user}/Maildir directory instead. I've gotten
everything running, and recently added amavisd-new, ClamAV and
SpamAssassin.
What I'd like to do is provide a system-wide rule that will relay
virus-infected messages and suspected spam to a particular Maildir for
each user.
Searching around I've found ways to do this with maildrop, procmail,
other MTAs, etc., and ways for Exim that would work if there were a
valid $home (like writing an Exim filter in .forward or a system filter
that delivers to $home/Maildir/.Junk or the like). Unfortunately I
haven't found anything on doing this with virtual domains, where the
"home directory" is itself conditional on properties of the incoming
message.
What I'd like is somehow add a rule to my LDAP user transport that
says "if there's an X-Spam-Status = YES or if the subject starts with
VIRUS (is there a mail header for ClamAV+amavis I can use instead?)
deliver to