I did find the location of the "spam" folder.
It's in /etc/exim.conf
Code:
directory = "${extract{5}{:}{${lookup passwd{$local_part}{$value}}}}/mail/.spam"
However, this will get overwriten on each Update. Also this requires that each client set the Spam Box to ON.
So I found a better solution:
( I did want this to be global so I didn't have to run it for each user)
( WHM 11.30.1 (build 4) CENTOS 5.6 x86_64 )
1. Turn OFF "Spam Box" in WHM -> Tweak Settings -> Mail.
This just allows the user to control it, but I wanted it always on and I want to forward to the ".Junk" folder anyways.
WHM -> Tweak Settings -> Mail -> Enable SpamAssassin Spam Box: OFF
WHM -> Tweak Settings -> Mail -> Enable SpamAssassin spam filter: ON
WHM -> Exim Configuration Editor -> SpamAssassin Options -> SpamAssassin: Forced Global ON: ON
2. Go into WHM - > Exim Configuration Editor -> Advanced Editor
( Be Careful)
About halfway down right after:
Code:
#spam_filter:
# driver = forwardfile
# file = /etc/spam.filter
# no_check_local_user
# no_verify
# filter
# allow_system_actions
you will see a textarea box that will allow you to input text.
Here you will need to create a new Filter. Here is mine and should work for most.
Code:
#
# CUSTOM - Account level filtering for everything but the main account
#
custom_central_filter:
driver = redirect
allow_filter
no_check_local_user
file = /etc/cpanel_exim_system_filter_custom
directory_transport = address_directory
file_transport = address_file
domains = +user_domains
pipe_transport = virtual_address_pipe
reply_transport = address_reply
router_home_directory = ${extract{5}{:}{${lookup passwd{${lookup{$domain}lsearch*{/etc/userdomains}{$value}}}{$value}}}}
user = "${lookup{$domain}lsearch* {/etc/userdomains}{$value}}"
allow_fail
no_verify
Save
3. Now you need to create a custom filter file that matches the one shown above.
/etc/cpanel_exim_system_filter_custom
Contents:
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/.Junk}{yes}{no}}" contains "yes"
then
save "$home/mail/$domain/$local_part/.Junk/" 660
finish
endif
endif
Note:
# Exim filter (is required)
This will now Redirect all mail marked as Spam by Spamassassin to the users "Junk" folder.
this is now affecting all accounts. If the Junk folder does not exist it will attempt to create it.
If the user is not already subscribed to this folder then they will not see the email.
Although Dovecot, Courier, Squirrel Mail, RoundCube, Outlook, and Thunderbird all seem to create it by default.
This does still allow each user to specify the spam rating before it is marked as spam. The default is 5.
There is only one issue with this and it is that this filter runs first before all other user defined filters.
If someone has a solution to making this run after all user defined filters then please let me know.
Thanks