LISTSERV for Windows may use the SMTPL.EXE SMTP "listener" service to submit inbound email to a third-party spam scanning product. This feature allows sites with significant inbound spam problems to scan and reject spam before it reaches the main LISTSERV process, thus freeing LISTSERV itself to handle legitimate email.

Note: Although this hook can, in principle, be used with any spam scanning product, all the examples and step-by-step instructions in this section will relate to SpamAssassin, a popular freeware spam filter that can be downloaded from https://spamassassin.apache.org.


Important: L-Soft did not author SpamAssassin and is unable to correct problems with the SpamAssassin product itself. L-Soft does not make any legal representations or warranties regarding SpamAssassin. Although L-Soft’s support department will gladly answer questions about the integration of SpamAssassin and SMTPL, we cannot answer questions about SpamAssassin itself.

5.1 Enabling


To enable SMTPL-level spam filtering, you must:

    • Install a third-party spam filter.
    • Provide a script that will scan messages using the third-party filter (if using SpamAssassin, you can use the L-Soft supplied script).
    • Activate this script by making changes to the LISTSERV configuration (which is also used by SMTPL) and restarting SMTPL.

SMTPL will then scan every message it processes, with a few exceptions, and reject messages identified as spam.

5.2 Configuring LISTSERV to Use SpamAssasin


This section contains step-by-step instructions for configuring LISTSERV to use SpamAssassin using one of the L-Soft supplied scripts. Throughout this section, we will make the following assumptions:

    • You are running LISTSERV 16.0 or later (preferably the Generally Available version, currently 17.0) with the version of SMTPL.EXE that shipped with it (version 1.0w) or later.
    • SpamAssassin has already been installed and configured on a server that we will call spamd.example.com. This can, but does not have to be, the machine on which LISTSERV is installed (i.e. you can run LISTSERV on Windows and SpamAssassin on unix).
    • spamd has been started and is configured to accept incoming requests from the machine on which LISTSERV is installed.
    • You have a test message file at your disposal to verify the operation of lspamc/spamd. We will call this file testmsg.txt.

Step 1 of 4: Install and Test SpamAssassin Client

Download and install the lspamc.exe executable from L-Soft, and place it in a directory in LISTSERV’s path – for instance, the LISTSERV\MAIN directory.

Note: lspamc.exe is slightly different from the spamc.exe provided for LISTSERV spam scanning.  lspamc.exe should be used for SMTPL spam scanning.


To test the client, issue the following command (substituting the correct FQDN for your SpamAssassin server for "spamd.example.com"):

C:\> lspamc -c -d spamd.example.com < testmsg.txt
3.8/5.0


The response must be two numbers as shown above, but the numbers can be different than in the example (they are the SpamAssassin score of the test message). Any other response indicates an error. In that case, make sure that spamd is configured to allow connections from the LISTSERV host.

Step 2 of 4: Install REXX (if not already available)

Install a REXX interpreter, such as Regina REXX (https://regina-rexx.sourceforge.io/, Windows kit download available at https://sourceforge.net/projects/regina-rexx/files/regina-rexx/ .  When prompted to register .REXX as a path extension, you should do so. Alternatively, you can simply download REXX.EXE from L-Soft and place it in the same directory where you saved lspamc.exe.

Note: At time of writing, the latest version of Regina REXX is 3.9.1; however, SASMTPL.REXX that you will download in the next step is incompatible with Regina REXX version 3.1 and later. The version of REXX.EXE downloadable from L-Soft is version 3.0, and is known to work with the script.


Step 3 of 4: Install and Configure the SASMTPL Script

    • Download the L-Soft supplied sample script:

https://ftp.lsoft.com/LISTSERV/Windows/CONTRIB/SASMTPL.REXX.zip

    • Edit the script to configure, at a minimum, the address of your SpamAssassin server. You may also want to change the other parameters.
    • Make any other changes that you deem appropriate.
    • Save the script in LISTSERV’s main directory (for instance, C:\LISTSERV\MAIN ).
    • You can call the script anything you want, but in this example we will assume that you have left the name unchanged (SASMTPL).

Step 4 of 4: Enable the SASMTPL Script

To enable the script, add the following lines to LISTSERV’s configuration:

SMTP_SPAM_EXIT=!C:\LISTSERV\MAIN\REXX.EXE C:\LISTSERV\MAIN\SASMTPL.REXX
SMTP_SPAM_THREADS=75
SMTP_SPAM_CHECK=[list of target hostnames to check]


Change the paths in SMTP_SPAM_EXIT to match your local installation. Ensure that the line begins with an exclamation point (!).

Normally, SMTP_SPAM_CHECK may be set to %MYDOMAIN%.  If you host multiple domains on the same LISTSERV server, you will need to list each domain (space-separated).

Note: For the 75 concurrent spam scans configured in the example, 750M-1G of memory will be required. Depending on available resources, you may want to start lower.


Restart SMTPL to make the change take effect, then mail a known spam message to a test list to confirm that everything is working as it should.