Deliver Spam to Spam folder, globally

intelihost

Registered
Jan 20, 2017
1
0
1
Brazil
cPanel Access Level
Root Administrator
Hi guys.
I had this Exim Filter set up globally, so all Spam was delivered right to a Spam Folder.
Then I set up a new server running CentOS 7 and decided to set the rule up again, using the /usr/local/cpanel/etc/exim/sysfilter/options directory, so it would be listed as a separate filter in Mail Settings.

However, nothing happens. Can you guys help me out?

Code is:
Code:
# Exim filter

if not first_delivery and error_message then finish endif

#Spam
if ($h_X-Spam-Status: contains "Yes") then
  if "${if exists {$home/mail/$domain/$local_part/.Spam}{yes}{no}}" contains "yes"
   then
    save "$home/mail/$domain/$local_part/.Spam/" 660
    finish
   endif
endif
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,254
463
Hello,

The filter rule would not work in cases where the .Spam folder is not yet created.

An alternative method is to simply create the /home/$username/.spamassassinboxenable file under all accounts, which will enable the Spam Box option. There are some user-submitted commands discussed on the following thread:

Apache SpamAssassin global enable anyone?

Thank you.