====== Use SpamAssassin with the Synchronet Mail Server ======
The Synchronet [[:server:mail|SMTP Server]] may use a SpamAssassin server ([[http://spamassassin.apache.org/full/3.1.x/doc/spamd.html|spamd]]) to rate received messages and tag or even reject them based on the results.
===== Installation =====
When installing SpamAssassin, make sure you enable the ''spamd'' (daemon).
==== Windows ====
Apparently, [[http://wiki.apache.org/spamassassin/SpamdOnWindows|it is possible]] to run ''spamd'' on Windows, but *nix OSes are much preferred.
==== Linux ====
On some Linux distributions, you may enable the SpamAssassin daemon (spamd) using ''chkconfig'' command:
chkconfig --add spamassassin
On some Linux distributions, you may start/stop/query the SpamAssasin daemon (spamd) using the ''service'' command:
service spamassasin start
Or by directly executing the init script:
/etc/init.d/spamassassin start
Don't forget to create a daily cron job to update your SpamAssasin database:
sa-update && /etc/init.d/spamassassin restart
===== Configuration =====
Synchronet comes with a [[:module:spamc|JavaScript implementation]] of the SpamAssassin spamd client (''[[module:spamc]]'').
To enable this client as a Synchronet //External Mail Processor//, edit your ''[[dir:ctrl]]/[[config:mailproc.ini]]'' file, adding or updating the following section:
[SPAMC]
Command=spamc.js
AccessRequirements=user equal 0 or guest
ProcessSpam=false
ProcessDNSBL=false
Disabled=false
The ''AccessRequirements'' key value above tells the Synchronet Mail Server not to execute this mail processor for unauthenticated clients (''user equal 0'') or for the //Guest// user account, if there is one.
The ''ProcessSpam'' and ''ProcessDNSBL'' options tell the Synchronet Mail Server not to execute this mail processor if the message was received from a [[:config:spamblock.cfg|SPAM-blocked]] or [[:config:dns_blacklist.cfg|DNS-Blacklisted]] sender.
Alternatively, you may specify ''To'' and/or ''From'' keys to limit the mail sender and/or recipients for which messages will be processed by SpamAssassin.
==== Command Line ====
The Synchronet [[:module:spamc]] module supports some of the same command line options as the SpamAssassin ''spamc'' program and these may be included (with or without the dashes) in the ''Command'' key value included in the ''[SPAMC]'' section of your ''[[config:mailproc.ini]]'' file:
^Option ^Usage ^Description^
|d |''-d //address//'' |Specify IP address of ''spamd'' host (default: ''127.0.0.1'')|
|p |''-p //port//'' |Specify the TCP port number of the ''spamd'' server (default: 783)|
|u |''-u //username//''|Specify the user-id that ''spamd'' should run as|
|s |''-s //bytes//'' |Specify the maximum message size (in bytes) that ''spamc'' will attempt to process (default: 500000)|
In addition, the Synchronet [[:module:spamc]] supports the following command line options:
^Option ^Usage ^Description^
|spamonly |''spamonly'' |Modify SPAM messages only (default: modify all messages)|
|reject |''reject //level//''|Reject SPAM messages over specified score threshold, modify and pass-through HAM|
|debug |''debug'' |Enable debug log output|
=== Examples ===
Modify and pass-through all messages:
Command=spamc.js
Modify SPAM messages only, pass-through all:
Command=spamc.js spamonly
Reject SPAM messages, modify and pass-through HAM:
Command=spamc.js reject
Reject SPAM messages over specified score threshold (8.0 in this example), modify and pass-through HAM:
Command=spamc.js reject 8.0
Reject SPAM messages over specified score threshold (8.0 in this example), modify SPAM, and pass-through HAM and SPAM:
Command=spamc.js reject 8.0 spamonly
===== See Also =====
* [[:server:mail|Mail Server]]
* [[:module:spamc]]
* [[:config:mailproc.ini]]
* [[:howto:|HowTo index]]
{{tag>antispam email spam}}