Verifying SpamAssassin Operation
In order to be sure that your SpamAssassin installation is working, there are a couple of tests that can be performed. These tests will determine if the SpamAssassin engine is able to identify spam messages with the default installation. The first test is to see if a spam message is identified by the filters correctly, and the second test determines whether a non-spam message is allowed through the program.
Testing a Spam Message
Fortunately, SpamAssassin ships with a message that you can use to easily verify that the filters identify a spam message correctly. The message SpamAssassin ships with is shown in Figure 3.6.
Table 3.6. SpamAssassin test spam message.
Subject: Test spam mail (GTUBE) |
Message-ID: <GTUBE1.1010101@example.net> |
Date: Wed, 23 Jul 2003 23:30:00 +0200 |
From: Sender <sender@example.net> |
To: Recipient <recipient@example.net> |
Precedence: junk |
MIME-Version: 1.0 |
Content-Type: text/plain; charset=us-ascii |
Content-Transfer-Encoding: 7bit |
This is the GTUBE, the |
|
If your spam filter supports it, the GTUBE provides a test by which you can verify that the filter is installed correctly and is detecting incoming spam. You can send yourself a test mail containing the following string of characters (in upper case and with no white spaces and line breaks): |
XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X |
You should send this test mail from an account outside of your network. |
The test is run by emailing yourself the sample spam message like this:
bash$ mail user@mydomain.com < sample-spam.txt
This command assumes that the sample-spam.txt file containing the test SpamAssassin message is in the current directory. Replace user@mydomain.com with your email address on the machine running SpamAssassin. If this message is caught by the filter, by default you will receive a message (see Figure 3.16) from SpamAssassin telling you about the spam message.
Testing a Non-Spam Message
In order to test a non-spam message, take a message from your inbox and mail it to yourself. For example, from the command line, issue the following command:
bash$ mail user@mydomain.com < sample-not-spam.txt
We assume that the sample-not-spam.txt file, a regular email message with a header and body, is in the current directory. Replace user@mydomain.com with your email address as in the previous example. This message should not be caught by the filters but rather should be allowed through SpamAssassin to your inbox.