How to setup SpamAssassin

1. First, we need to prepare several necessary files.

 

2. Install ActivePerl to C:\perl. Because ActivePerl will add c:\perl\bin to your system path, I suggest you to restart your raidenmaild to take effect.

3. Extract SpamAssassin ZIP to C:\Mail-SpamAssassin-3.1.0

4. Execute NMAKE to extract 2 files (NMAKE.exe and NMAKE.err) to C:\perl\bin.

5. Check your system path. Click [Start] -> [Run...] -> Input cmd to open a dos prompt window, please input echo %path% to check the c:\perl\bin was already added to your system path. If there is no such a path in system path, please go to [Control Panel] -> [System] -> [Advanced] -> [Environment variables] -> [System variables] -> [Path] to add c:\perl\site\bin. After adding path done, open a new dos prompt window and restart raidenmaild to take effect.

6. change to C:\Mail-SpamAssassin-3.1.0 in dos prompt window.

7. Input perl makefile.pl and press ENTER, it will ask you question like below

Build spamc.exe (environment must be set up for C compiler)? (y/n) [y] n

Answer n , then it will ask you

What email address or URL should be used in the suspected-spam report
text for users who want more information on your filter installation?
(In particular, ISPs should change this to a local Postmaster contact)
default text: [the administrator of that system]

Please input administrator email address here. In the processing, you could ignore module missing error.

 

8. Input nmake to compile.

9. Input nmake install to install spamassassin to perl directory.

10. Copy c:\perl\site\share\spamassassin\*.* to c:\usr\share\spamassassin (c:\usr\share\spamassassin needs to created manually)

11.Copy c:\perl\site\etc\mail\spamassassin\*.* to c:\etc\mail\spamassassin (c:\etc\mail\spamassassin needs to be created manually)

12. Find C:\perl\site\bin\spamassassin.bat , uncheck its read only flag, edit it with ultraedit or other editor, find @echo off, insert 2 line below it. (NAME Server is DNS Server, in this tutorial, I take 168.95.1.1 as DNS Server.)

SET RES_NAMESERVERS=168.95.1.1
SET LANG=en_US

 

13. It is time to test your spamassassin module. Let's switch to dos prompt window, change directory to C:\Mail-SpamAssassin-3.1.0 and input

spamassassin -D -t < sample-spam.txt > spam.txt

you will see these headers was added to spam.txt

X-Spam-Flag: YES
X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on arnor-ex
X-Spam-Level: **************************************************
X-Spam-Status: Yes, score=1000.0 required=5.0 tests=GTUBE,NO_RECEIVED,
NO_RELAYS autolearn=no version=3.1.0

That means your spamassassin module is able to work as we expected.

If you want to test non-spam mail, just input

spamassassin -D -t < sample-nonspam.txt > nospam.txt

 

14. Go to C:\Perl\site\etc\mail\spamassassin folder, edit the "local.cf" and modify below lines:

a) Remove the # character in ftont of the line "rewrite_header Subject *****SPAM***** "
b) REmove the # in front of the line "report_safe" and modify it to report_safe=0

15. Download spamassassin vb script (written by Jeroen) and extract to c:\mail directory and make 2 directories ( c:\mail\spam\BusyCheck\c:\mail\spam\BusySpam\ ) .

16. Edit SpamAssassinVBS.vbs , depend on your environment, it may need some modifications for those pathes:

  • Const strBusyCheck = "c:\mail\spam\BusyCheck\"

c:\mail\spam\BudyCheck\ will store temp mail file while checking by spamassassin

  • Const strBusySpam = "c:\mail\spam\BusySpam\"

c:\mail\spam\BusySpam\ will store temp spam mail after checking process.

  • Const strLogPath = "c:\mail\SpamAssassin.log"

spamassassin log file path

  • Const strNoSpamFile = "nospam.txt"

If you dont't want spamassassin vbs to move mail for some specific accounts, just create a empty file "nospam.txt" in his mailbox directory.

  • Const strClamWinExePath = "d:\clamwin\bin\clamscan.exe"

the path of clamscan.exe

  • Const strClamWinTempDir = "d:\clamwin\temp"

ClamWin temporary directory.

  • Const strSpamAssassinBatPath = "c:\perl\site\bin\spamassassin.bat"

spamassassin vb script path.

  • Const strGlobalWhiteList = "c:\mail\whitelist.txt"

global white list

 

17. Go to raidenmaild, [Mainmenu] -> [Setup] -> [Event Processor]

[Enable Event Processor] -- Checked

[All received mails] -- Checked

EXECUTE:

C:\mail\spamassassinVBS.vbs

PARAMETERS:

//b file=%F from=%S

(//b means no debug message)

Click [Add Event] and check it to enable it.

 

18. Then, you can send a mail to your mailbox to test spamassassin. If the previous steps are all done correctly, you should see the log just like below.

[2006/6/17 14:59:09] [2672] SMTP service connection from 192.168.0.2
[2006/6/17 14:59:09] [2672] 192.168.0.2 requests SMTP service - Sender: arnor@raidenmaild.com
[2006/6/17 14:59:10] [2672] 192.168.0.2 - Mail received (To:arnor@raidenmaild.com) 1167bytes ( 4.4 Kb/s)
[2006/6/17 14:59:10] [2672] SMTP service disconnect connection from 192.168.0.2
[2006/6/17 14:59:11] Save mail to <arnor> mailbox, the filename is _20060617145909-270988844-2672.eml 1282bytes
[2006/6/17 14:59:11] Event condition found(spamassassin), and execute the event successfully(C:\mail\spamassassinVBS.vbs //b file="C:\raidenmaild\Inboxes\arnor\_20060617145909-270988844-2672.eml" from=arnor@raidenmaild.com)

Note: When your system runs vbscript, anti-virus may block this action, you need to set it to be allowed.

 

19. Go to webmail to check this mail. If the mail was detected as spam, it will be maked "********SPAM********" in the subject (or be moved to \-unsolicited- folder, you could modify spamassassinVBS.vbs at will). Click [Mail Header] to see its header. you may find these mail headers:

X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on arnor-ex
X-Spam-Level:
X-Spam-Status: No, score=-0.7 required=5.0 tests=ALL_TRUSTED,AWL,HTML_MESSAGE autolearn=unavailable version=3.1.0

X-Spam-Status: No means this mail was not treated as spam.

 

20. Congratulations! You already integrated spamassassin with raidenmaild successfully.

 

Thanks for your reading.

Back to Index

Last update: 2011/12/08

Copyright ©2000-2011 RaidenMAILD TEAM

Copyright (C) http://www.raidenmaild.com/ . , 2000-2008 all rights reserved. The copyrighted works contained in this information service shall not be copied, reproduced, varied, altered, modified, adapted, distributed, performed and displayed in any form without the written permission of the copyright owner. All trademarks belong to their respective owners .