> Interesting, we run a similar setup with spamassassin and uvscan/clam-av > but currently only append ***SPAM*** to the subject forwarding email to > a separate dbmail folder if spam would be handy - I'll have a bash at > getting that working. (Although I've not done much with procmail)
Right think I've got it working, forwarding spam emails in to a separate mailbox for the user based on spamassassin results (if spam send to junk, if not send inbox). Had do to a little hacking on main.c (dbmail-smtp) though. Added another option '-nm' which allows you to specify a mailbox without a user (reads the to address from the 'deliver-to' and 'to' headers in the email). Changes to dbmailsrc/main.c: Old: printf (" %s -u [usernames] for direct delivery to users\n\n",argv[0]); New: printf (" %s -u [usernames] for direct delivery to users\n",argv[0]); printf (" %s -nm \"mailbox\" for normal delivery to mailbox\n\n",argv[0]); Old: /* we need to decide what delivery mode we're in */ if (strcmp ("-d", argv[INDEX_DELIVERY_MODE])==0) New: /* we need to decide what delivery mode we're in */ if (strcmp("-nm", argv[INDEX_DELIVERY_MODE])==0) { trace (TRACE_INFO,"main(): using NORMAL_DELIVERY to mailbox"); /* parse * for * destination * addresses * */ if (mail_adr_list ("deliver-to",&users,&mimelist) != 0) if (mail_adr_list ("to",&users,&mimelist) != 0) trace(TRACE_STOP,"main(): scanner found no email addresses (scanned for Deliver-To:) to mailbox"); deliver_to_mailbox = argv[2]; } else if (strcmp ("-d", argv[INDEX_DELIVERY_MODE])==0) recompile dbmail. Within amavisd.conf instead of: $forward_method = 'pipe:argv=/usr/local/sbin/dbmail-smtp -d ${recipient}'; Use: $forward_method = 'pipe:argv=/usr/local/bin/procmail -f-'; <procmailrc file (/usr/local/etc/procmailrc or /etc/promailrc)> # Divert spam :0: * ^X-Spam-Status: Yes |/usr/local/sbin/dbmail-smtp -nm "JUNK" # Deliver all other mail to inbox :0: |/usr/local/sbin/dbmail-smtp -n </procmailrc file> Restart amavis and all should work. Although I'm getting a ' procmail: Couldn't determine implicit lockfile from "/usr/local/sbin/dbmail-smtp"' error which I'll investigate, but other than that seems to work fine. Improvements welcome. HTH Simon