The XMS Mail Server comes with an XMS filter that allows you to filter your mail through the Apache SpamAssassin a very powerful industry standard spam filter.
Download, install, and configure spam assassin using the SpamAssassin Documentation. The XMS spam assasin filter uses the spamd daemon, so you need to make sure that is running. If the spamd process is not running, consult the spam assassin documentation for assistance.
![]() | Note |
|---|---|
| You do not need to install SpamAssassin on the same server as your XMS Email Server. For best performance and high availability you may wish to setup multiple dedicated spam assassin servers. See Load Balancing section below. | |
Once spamd is running and configured it is time to configure XMS to filter mail through SpamAssassin. This is done with the XMS Spam Assassin Filter (xms.filter.data.SpamAssassinFilter).
Put the filter tag inside the service tag for the xms.transport.smtp.SMTPService service class.
<filter class="xms.filter.data.SpamAssassinFilter" primaryhosts="127.0.0.1" discardlimit="20" friendly="10.0.0.*,127.0.0.1" ignore="spamtrap@*,spam@*" />
The discardlimit when set discards email with a spam score exceding its value. So with the current settings any email with a spam score over 20 will be silently discarded.
![]() | Note |
|---|---|
| Mail sent from an IP address in the friendly attribute, or mail matching one of the ignore addresses will not be passed through spam assassin. | |
![]() | Note |
|---|---|
| SpamAssassin uses port 783 by default, if you want to use a different port specify it as follows: 127.0.0.1:10783,10.0.0.10:10783 | |
The XMS SpamAssassin filter can balance spam checking load across multiple spam assassin servers. This can be configured by placing multiple IP addresses in the primary hosts attribute. Each IP should be comma seperated.
primaryhosts="127.0.0.1,10.0.0.10,10.0.0.11,10.0.0.12"
XMS will distribute spam checking to each host in the primary host lists. If a primary host goes down it is removed from the list and polled, if it comes back up it will be added to the primary host list again.
If all primary hosts are down, the secondary host list is used. These hosts are used only for failover if all primary hosts are down. They are configured with the secondaryhosts attribute:
secondaryhosts="10.0.0.20,10.0.0.21"
Unless you have specified a rejectlimit or a discardlimit the XMS SpamAssassin filter will simply add headers to the messages. The filter adds the following headers:
X-Spam-Checker-Version — displays the version of SpamAssasssin, and the server hostname used to check the message
X-Spam-Level — displays the spam score, one asterisk (*) for each value.
X-Spam-Status — shows spam score as a number, wether or not the message is spam, and lists which tests the message failed.
X-Spam-Report — shows a break down of each test the message failed, and the score for each test. If the message is not spam this header will not be present.
X-Spam-Flag — displays YES if the message is spam, if the message is not spam this header will not be present.
The headers may look something like the following:
X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on mail.yourdomain.com X-Spam-Level: ******************* X-Spam-Status: Yes, score=19.4 required=5.0 tests=AWL,BAYES_99,BIZ_TLD, DNS_FROM_AHBL_RHSBL,MIME_BOUND_DD_DIGITS,MIME_HEADER_CTYPE_ONLY, RAZOR2_CF_RANGE_51_100,RAZOR2_CHECK,URIBL_AB_SURBL,URIBL_SBL, URIBL_SC_SURBL autolearn=unavailable version=3.0.2 X-Spam-Report: * 4.1 MIME_BOUND_DD_DIGITS Spam tool pattern in MIME boundary * 2.3 BIZ_TLD URI: Contains an URL in the BIZ top-level domain * 0.1 RAZOR2_CF_RANGE_51_100 BODY: Razor2 gives confidence level above 50% * [cf: 100] * 5.8 BAYES_99 BODY: Bayesian spam probability is 99 to 100% * [score: 0.9961] * 1.5 RAZOR2_CHECK Listed in Razor2 (http://razor.sf.net/) * 0.3 DNS_FROM_AHBL_RHSBL RBL: From: sender listed in dnsbl.ahbl.org * 1.0 URIBL_SBL Contains an URL listed in the SBL blocklist * [URIs: betterloane.biz] * 0.4 URIBL_AB_SURBL Contains an URL listed in the AB SURBL blocklist * [URIs: betterloane.biz] * 4.3 URIBL_SC_SURBL Contains an URL listed in the SC SURBL blocklist * [URIs: betterloane.biz] * 0.1 MIME_HEADER_CTYPE_ONLY 'Content-Type' found without required MIME headers * -0.5 AWL AWL: From: address is in the auto white-list X-Spam-Flag: YES