How to forward mail flagged as SPAM by Spamassassin?

l.degroot01

Verified User
Joined
Feb 9, 2014
Messages
5
Could someone help me with the following issue?
I would like to forward SPAM which has been flagged as SPAM by Spamassassin to a special mailbox, like [email protected]

I have my own VPS with about 20 domains, but i would like to seperate the mail for each domain, or more specified: SPAM for domain1 must be forwarded to [email protected] and the same for the other domains.

Can someone give me a howto, or point me in the right direction for this?

Many thanx in advance.

Greetings Leslie
 
DirectAdmin's spam setup will move your spam email to the spam folder of the account user. If each domain is it's own user, won't this do what you want?

Jeff
 
Usually this is a good setup, but one of the domains have about 15 mailboxes. And the domain owner whant's to forward spam for all the boxes to an seperate mailbox, in this case [email protected]

Normally you set an catch-all box and configure spam-assassin to forward al spam to that box. However the client doesn't want that because than all mail will be forwarded to that box, even when it's sended to non existing boxes such as [email protected]

Maybe it's just not so simple to achieve what this particular client is hoping to achieve, but my flow of thougts is something as:

Spam is flagged as spam by Spamassassin, exim responds to this by replacing the recipient to [email protected].

Another issue to remember is that only spam for that domain must be forwarded to [email protected]

Other domains spam filtering must remain intact.
 
I'd suggest to update your exim.conf as the following:

Code:
 spamcheck_director:
   driver = accept
   condition = "${if and { \
                        {!def:h_X-Spam-Flag:} \
                        {!eq {$received_protocol}{spam-scanned}} \
                        {!eq {$received_protocol}{local}} \
                        {exists{/home/${lookup{$domain}lsearch{/etc/virtual/domainowners}{$value}}/.spamassassin/user_prefs}} \
                        {exists{/etc/virtual/${domain}/passwd}} \
                        { \
                        or \
                            { \
                                {!eq {}{${lookup{$local_part}lsearch{/etc/virtual/${domain}/passwd}}}} \
                                {!eq {}{${lookup{$local_part}lsearch{/etc/virtual/${domain}/aliases}}}} \
                                {eq {$local_part} {${lookup{$domain}lsearch{/etc/virtual/domainowners}}}} \
                            } \
                        } \
                        {<{$message_size}{500k}} \
                } {1}{0}}"
  retry_use_local_part
  transport = spamcheck
  no_verify

so to only scan an email if a valid account or alias exists.

Related: http://help.directadmin.com/item.php?id=156
 
Last edited:
Back
Top