How To Configure SpamAssassin for HMailserver in Windows Server 2003

Posted By: Tech Guy
Last Updated at 9:40 PM on Sunday Dec 6, 2009
Found in: Anti-SpamE-Mail

Setting up SpamAssassin for MailServer in Windows is a tricky thing to do.

Documentation on the subject is sparse and Google searches turn up very old posts or posts that point you in the wrong direction. Fortunately once you know the setup process, it is fairly straightforward and easy to do.

There are several different versions of SpamAssassin out there. The main branch requires you to download the source code, then download perl to compile the source as binaries. Fortunately in our case, there is already versions compiled for Windows in the form of SAWin32.

How to Configure SpamAssassin for HMailserver in Windows

  1. Download SAWin32 3.2.3.3, which is the latest windows build of SpamAssassin (As of September 8, 2009).
  2. Download the latest SpamAssassin for Win32 command-line tools 3.2.3.5
  3. Unzip both files into your computer with HMailServer installed under the path "c:\sa\"
  4. Next we will have to create a new Windows Service called "SpamAssassin". This will allow HMailServer to use SpamAssassin.
    1. Install the Windows Server 2003 Resource Kit Tools. This will give you the necessary INSTSRV.EXE and SRVANY.EXE files to run SA as a service
    2. Go to Start Menu -> Run -> cmd
    3. Under the command line, enter in the following line (with quotes):
      "C:\Program Files\Windows Resource Kits\Tools\INSTSRV.EXE" SpamAssassin "C:\Program Files\Windows Resource Kits\Tools\SRVANY.EXE"

    4. Once installed, open up Regedit
    5. Go to HKLM -> SYSTEM -> CurrentControlSet -> Services -> SpamAssassin
    6. Add a new key called "Parameters"
    7. Under Parameters, add a new String Value of Application, and set the value data to (without quotes):
      "c:\sa\spamd.exe -l -s c:\sa\spamd.log --round-robin"

    8. Then go to the services control panel and start up the spam assassin service.
    9. If there are any issues, check the c:\sa\spamd.log file for more info
  5. Then you might have to allow dccproc and spamassassin in your firewall
  6. Adjust your hMailServer settings to allow the incoming e-mail check against SpamAssassin
  7. And finally you might have to restart your hMailServer service for the new service to take effect.
Anyway, it took me quite a while to figure it out, but once I did, I have been spam free! Good Luck!


Article Comments

 
hi, why do i have to use C:sa ?
i have hmail installed in default directory.

thanks
Marcelo


marcelo
Sat Oct 17, 2009 10:43 AM

Worked like a charm, thanks for posting this!

XaivierX
Tue Oct 20, 2009 6:52 PM

Thanks!
It worked perfectly. This is the only howto I have found after a lot of search.
Tested on Windows Server 2007 with "Windows Server 2003 Resource Kit Tools".

emilio
Sat Oct 24, 2009 11:12 PM

Correction: Windows Server 2008. (mistyped)

emilio
Sun Oct 25, 2009 10:44 AM

Marcelo, c:\sa is where you unzip the first two files to. In this folder we're installing the files for the SpamAssassin spam filter, not hMailServer.

If you put SpamAssassin somewhere other than the c:\sa folder, be sure to change the paths specified in Step 4.7.

Aaron
Mon Oct 26, 2009 2:49 PM

Hi, is necesary or useful install the SAWin32? It's for e-mails clients, no for servers, in this case for hmailserver.

Thanks for the how-to.

Daniel
Sat Oct 31, 2009 6:48 PM

Hi, is necesary or useful install the SAWin32? It's for e-mails clients, no for servers, in this case for hmailserver.

Thanks for the how-to.

Daniel
Sat Oct 31, 2009 6:59 PM

Hello Tech Guy,
When I do the install of spamD.exe as a service (point 4.8 on your tutorial), it return an error : can't start the service.
So, until I founded you tutorial I heard about "SpamDloaderService" ( http://www.tooms.dk/software/spamdloaderservice/ ) and it's ok.

So to install it :
1. download and unpack to : C:\spamdloaderservice\
2. run : InstallService.bat
3. run : SpamDloaderConfig.exe
3.1 on "spanD" change path to : C:\SA\SpamD.exe and save
3.2 return to "spamDloader" and try to start.

Bye..
Aktar




Aktarcom
Mon Nov 16, 2009 4:41 PM

Great procedure, much appreciated!

After the terrible stuff, incorrect build procedures and all the other junk references on the web and on Spamassassins site.

Question, why did you go with version 3.2.3.3 when the current version of Spamassassin has been 3.2.5 for well over a year?

Mike
Fri Dec 4, 2009 7:54 PM

if spamassassin is pre installed on the server, as is the case with me. I installed hmail server later then what should be the procedure.

Thanks.

KP
Tue Dec 22, 2009 1:09 PM



Jeppe
Fri Feb 12, 2010 2:36 PM

Hm it will not post my message :S! But thanks it works

Jeppe
Fri Feb 12, 2010 2:38 PM

SAWin32 3.2.3.3 is extremely outdated, and looks to be not supported since about 2007.

It also is very troublesome under windows in general. If you can, install SA on a *NIX platform.

OmeD
Tue Mar 16, 2010 11:27 AM

Hello Tech Guy,
thanks for posting this!

After installation I have update the spam-detecting rules with the command :
sa-update.exe --nopgp
Download sa-update from http://sawin32.sourceforge.net/
This is necessary to update some rules like FH_DATE_PAST_20XX

emmex
Tue Apr 13, 2010 11:07 AM



Greg
Tue May 4, 2010 5:46 AM

Hello,

This is a great procedure. I installed SA on Server 2003 and it seems everything worked. I was able to start the service and go in hmailserver and start SA. Only I'm getting an error when I double-click the SAProxy "Can't create listen socket on port 110: unknown error at line 490 pl". Do you know what this is? How can I tell if SA is working? Thanks for any help you can provide.

Joe

Joe
Mon Jun 7, 2010 7:52 AM

Hi

This step by step installation guide works great!! I installed in my windows 2003 server, it works perfect

Thanks Tech guy

Regards
Vijay Anand


Vijay Anand
Thu Oct 21, 2010 6:51 AM

It works great in Server 2008. I tested these procedures in Standard edition. Afew things to note that may be of help...

1. Follow the directions listeed in the above procedures! Add a step between 4(1) and 4(2) to install SAWin32 after extracting to the c:\sa folder you created. That part wasn't 100% clear to me from reading the above procedure, but I'm 100% all there anyway...

2. If installing SpamAssassin using this procedure, you must run the command in step 4(7) from an elevated command prompt or you'll get an error saying you'e not allowed to perform the function.

We're spam free after this install!




caitlyn
Sat Nov 6, 2010 3:25 PM

Great great post!!!
I installed it in server 2003 and it works perfectly. I tweaked the spam settings in hmailserver and the spam level has gone down to almost nothing.
Thanks a lot

Elie
Sun Nov 6, 2011 11:01 AM

Used Task Scheduler instead - and created an on system startup task to call a batch file that starts spamd with the desired options.


Ed
Wed Feb 15, 2012 2:33 PM

Ran the instructions. Hmail recognizes it fine (finally) but it doesn't see Spamd when I try and do a update
the error message is
C:\SA>sa-update.exe --nogpg
Error: cannot load shared library 'C:\SA\spamd.exe'

Allmost evey install I do I get this error message
Also in task manager it says spamasassin not SpamD
Why

Thanks
Running Win server 2008 64 bit




Bob Escher
Fri Apr 13, 2012 4:12 AM

This is a fantastic walk through :-) I was searching the internet for ages to find a solution on how to integrate Spam Assassin into hmailserver.

All works great and we're now SPAM free!

Thanks - Works on Windows 2008 32bit SP2

Envision
Fri Jul 27, 2012 5:06 AM

Thanks for a great and detailed procedure. Worked great here.
I have one question. How do you change the required_score value? I found the file c:\sa\etc\spamassassin\local.cf. Changed the value there, restarted the hmailserver service and the spanassassin service, but the messages still say 6.3 which is what was in their to start. Any ideas?

Joe
Wed Feb 6, 2013 11:14 AM

I figured it out. When you unzip the twi downloaded file from step 3, the do not create all the correct file structures. It will still work, however, SA runs with all default parameters because it can't find the local.cf or user template files. In the unziped path, yuo have c:\sa\etc\spamassassin, but the code is looking for it in c:\sa\etc\mail\spamassassin. I copied files to the mail\spamassassin folder and now I can change all the SA parameters.

Joe
Wed Feb 6, 2013 5:23 PM

I am having the service fail to start on Server 2008. I noticed the same installation step being needed as noted in Caitlyn's comment. I am curious though if perhaps there is one extra layer of directory due to how I installed it.

Should spamd.exe end up in the same directory as saproxy.exe (assuming following these directions and not changing any other configuration pointers) when all is in place? Should the service start saproxy.exe or spamd.exe? I used the sc command to create a pretty bare service and then followed the instructions to add the key and string to the registry.

Any quick command-line tests that should help in diagnosing? Or for performing some basic functional tests once it does start? I am not seeing anything generated in spamd.log unless I execute "c:\sa\spamd.exe -l -s c:\sa\spamd.log --round-robin" directly.

Kyle
Tue May 21, 2013 10:29 AM

I am having the service fail to start on Server 2008. I noticed the same installation step being needed as noted in Caitlyn's comment. I am curious though if perhaps there is one extra layer of directory due to how I installed it.

Should spamd.exe end up in the same directory as saproxy.exe (assuming following these directions and not changing any other configuration pointers) when all is in place? Should the service start saproxy.exe or spamd.exe? I used the sc command to create a pretty bare service and then followed the instructions to add the key and string to the registry.

Any quick command-line tests that should help in diagnosing? Or for performing some basic functional tests once it does start? I am not seeing anything generated in spamd.log unless I execute "c:\sa\spamd.exe -l -s c:\sa\spamd.log --round-robin" directly.

Kyle
Tue May 21, 2013 10:38 AM

I am having the service fail to start on Server 2008. I noticed the same installation step being needed as noted in Caitlyn's comment. I am curious though if perhaps there is one extra layer of directory due to how I installed it.

Should spamd.exe end up in the same directory as saproxy.exe (assuming following these directions and not changing any other configuration pointers) when all is in place? Should the service start saproxy.exe or spamd.exe? I used the sc command to create a pretty bare service and then followed the instructions to add the key and string to the registry.

Any quick command-line tests that should help in diagnosing? Or for performing some basic functional tests once it does start? I am not seeing anything generated in spamd.log unless I execute "c:\sa\spamd.exe -l -s c:\sa\spamd.log --round-robin" directly.

Kyle
Tue May 21, 2013 11:07 AM

Apologies for the duplicate posts. I just refreshed my browser a few times checking for replies and did not realize the form was still populated and it was posting repeatedly.

kyle
Tue May 21, 2013 3:11 PM

I used this

http://blog.innove.it/index.php/2010/11/install-spamassassin-on-windows-server-2008-as-a-service/

to install SA in Server 2008 R2 using the same parameters shown here. Everything went smoothly

Marcello
Thu Mar 13, 2014 11:50 AM

Your Tutorial is Absolutely Working Fine. Thanks.

Amit
Thu May 22, 2014 1:52 AM

AWESOME! Got it to work using Server 2012. Same procedure works just fine, even with compatibility warnings installing the Server 2k3 toolkit.

Huyabusa1300
Sun Aug 17, 2014 1:47 PM

I tried following the instructions but the service stops automatically without any error message generated.

Serihon
Thu Feb 19, 2015 2:15 PM

Buenas noches, tengo instalado el windows server 2012 x64 me podrian decir como puedo integrar el spamassassin con el hmailserver

ulises
Sun Mar 26, 2017 5:06 AM



Post a Comment

 


Name:


E-Mail:


Comments:  






Copyright 2017 Alter Procedure All Rights Reserved