Results 1 to 3 of 3

Thread: Can you change the Spamassassin Spam Box folder

  1. #1
    Member
    Join Date
    Jul 2011
    Posts
    6

    Default Can you change the Spamassassin Spam Box folder

    Is is possible to change the Spam Box Folder?

    Maybe to INBOX.Junk instead.

    Is it possible to Capitalize it to "Spam" instead of "spam"?


    If so, can these changes be done for all new accounts?

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Can you change the Spamassassin Spam Box folder

    The spam box name cannot be changed from the information I checked so far, but you could use a filter rule rather than the spam box to put emails into a different box:

    #SpamFolderRule
    if
    $h_X-Spam-Bar: contains "+++++"
    then
    save "/home/username/mail/.foldername/" 660
    endif

    This could be done in cPanel > Account Level Filtering area by selecting "Create a New Filter" option, then using Spam Bar, contains, +++++ (this is a score of 5.0 or greater) in the "Rules" area. In the "Actions" area, select Deliver to folder and then click the "Change" button to change to a set folder on the account.

    If you want this for each individual email account, you would want to do this in the User Level Filtering area instead for each email account.

    If you do want to try to automate it, you'll have to add not only rules for each email account in /etc/vfilters/domain.com file where domain.com is the domain name in question, but also in /home/username/etc/domain.com/emailuser/filter file where username is the cPanel username, domain.com is the domain name, and emailuser is the email account user's name such as admin in admin@domain.com. You'd want to enable a filter and then cat the file to see how the filter file looks typically at that location.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Member
    Join Date
    Jul 2011
    Posts
    6

    Default Re: Can you change the Spamassassin Spam Box folder

    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
    Last edited by spadmin; 08-03-2011 at 03:05 AM. Reason: Added my Setup

Similar Threads

  1. SpamAssassin>Spam Box
    By D-Litz in forum E-mail Discussions
    Replies: 5
    Last Post: 06-04-2010, 06:45 AM
  2. spamassassin spam box issue
    By paysite-cash in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 09-01-2008, 06:19 AM
  3. Box trapper/ Spam Ass./white list/spam box/etc
    By cmcprodmgr in forum E-mail Discussions
    Replies: 17
    Last Post: 06-25-2008, 02:13 PM
  4. SpamAssassin not working and no spam box
    By ServerGuru in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 10-09-2004, 11:13 PM
  5. SpamAssassin Spam Box
    By trparky in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 07-18-2003, 12:20 AM

Tags for this Thread