MBF Knowledge Base

How do I prevent spam emails from being forwarded to a forwarding address that I have set up for my users?

There are a few ways this can be accomplished:

1.) Enable the SpamAssassin portion of the exim.conf file then configure it how you need it to work depending on whether you want to drop or discard the message. For example:

acl_check_recpt:

warn
domains = !+spamdiscard_domains
set acl_m_denyspam = yes

warn
domains = +spamdiscard_domains
set acl_m_denyspam = no

acl_check_data:

drop
hosts = !+relay_from_hosts
condition = ${if eq{$acl_m_denyspam}{yes} {yes}{no}}
!senders = postmaster@*
message = Spam message detected; message rejected.\n\
If you think this is wrong, get in touch with postmaster.
condition = ${if match{$recipients}{postmaster}{no}{yes}}
condition = ${if >{$spam_score_int}{50}{1}{0}}
log_message = msg rejected due to spam score of $spam_score
delay = 15s

discard
hosts = !+relay_from_hosts
condition = ${if eq{$acl_m_denyspam}{no} {yes}{no}}
!senders = postmaster@*
message = Spam message detected; message discarded.\n\
If you think this is wrong, get in touch with postmaster.
condition = ${if match{$recipients}{postmaster}{no}{yes}}
condition = ${if >{$spam_score_int}{50}{1}{0}}
log_message = msg discarded due to spam score of $spam_score

 

2.) Add a POP3 account for each forwarder. For example:

Add a POP3 account for each forwarder
Set up a filter on that POP3 account to discard any mail with a spam score greater than xx
Set up the forwarder.

This option may quickly fill up a pop3 account, so be sure to make arrangements to clear out those mailboxes at some point or set up a cronjob to delete the contents of that mail folder every so often.