Sun Java System Messaging Server 6.3 Administration Guide

ProcedureTo File Spam to a Separate Folder

This example tests messages arriving at the local message store and files spam into a folder called spam. The first three steps can be done in any order.

  1. Create the SpamAssassin configuration file.

    The name and location of this file is specified in Step 2. A good name is spamassassin.opt. This file contains the following lines:


    host and port specify the name of the system where spamd is running and the port on which spamd listens for incoming requests. mode=0 specifies that a string, specified by verdict, is returned if the message is perceived as spam. debug=1 turns on debugging in the SpamAssassin library. See Table 14–3

  2. Add the following lines to the option.dat file:

    ! for Spamassassin
    spamfilter1_string_action=data:,require "fileinto"; fileinto "$U";

    spamfilter1_config_file specifies the SpamAssassin configuration file.

    spamfilter1_library specifies the SpamAssassin shared library.

    spamfilter1_optional=1 specifies that the MTA continue operation if there is a failure by spamd.

    spamfilter1_string_action specifies the Sieve action to take for a spam messages.

    In this example, spamfilter1_string_action is not necessary because the default value already is data:,require "fileinto"; fileinto "$U";. This line specifies that spam messages are sent to a folder. The name of the folder is the spam verdict value returned by SpamAssassin. The value returned by SpamAssassin is specified by the verdict option in spamassassin.opt. (See Step 1.) In this case, the folder name is spam.

  3. Specify the messages to be filtered.

    To filter all messages coming into the local message store, change the imta.cnf file by adding the destinationspamfilterXoptin spam keywords on the ims-ms channel:

    ! ims-ms
    ims-ms defragment subdirs 20 notices 1 7 14 21 28 backoff "pt5m" "pt10m" 
    "pt30m" "pt1h"  "pt2h" "pt4h" maxjobs 4 pool IMS_POOL fileinto
    $U+$S@$D destinationspamfilter1optin spam
  4. Recompile the configuration and restart the server. Only the MTA needs to be restarted. You do not need to execute stop-msg.

    # imsimta cnbuild
    # imsimta restart
  5. Start the spamd daemon. This is normally done with a command of the form:

    spamd -d

    spamd defaults to only accepting connections from the local system. If SpamAssassin and Messaging Server are running on different systems, this syntax is required:

    spamd -d -i listen_ip_address -A allowed_hosts

    where listen_ip_address is the address on which to listen and allowed_hosts is a list of authorized hosts or networks (using IP addresses) which can connect to this spamd instance.

    Note – can be used with -i listen_ip_address to have spamd listen on all addresses. Listening on all addresses is preferable because it spamfilterX_verdict_n avoids having to change command scripts when changing a system’s IP address.