Scanning Outgoing Emails for Spam

jtopjian

Member
Mar 8, 2009
9
0
51
Hello,

It looks like there are a lot of past questions about this subject on the forums, but I haven't found a complete solution yet.

I would like to scan all outgoing emails for Spam using Exim and Spamassassin. I realize there are other spam tools out there and I would enjoy trying them out when I have time.

Right now I've pieced together a route and transport from some Exim docs:

Route:

Code:
spamcheck_router_test:
    no_verify
    domains = testingoutgoingdomain.com
    condition = "${if and { {!def:h_X-Spam-Flag:} {!eq {$received_protocol}{spam-scanned}}} {1}{0}}"
    driver = accept
    transport = spamcheck_test

Transport:

Code:
spamcheck_test:
    debug_print = "T: spamassassin_pipe for [email protected]$domain"
    driver = pipe
    command = /usr/sbin/exim -oMr spam-scanned -bS
    use_bsmtp
    transport_filter = /usr/bin/spamc
    home_directory = "/tmp"
    current_directory = "/tmp"
    user = mailnull
    group = mailnull
    return_fail_output
These blocks will scan all messages going to testingoutgoingdomain.com. It works great and when a message is flagged as spam using GTUBE, I get a standard SpamAssassin report.

But now instead of sending the email as a SpamAssassin report, I'd like to either bounce it or deliver it to the Spam folder of the sending user. I can't figure out how to do this.

I know I have to create a new route that checks for the Spam Flag, but other than that, I'm lost.

Does anyone know how?

Thanks
Joe