Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.

I scanned through the tutorial and didn't see it. You should be able to test it by just running spamd in a dos box for now. ( spamd -D -u username ) When you know what command line options work best for you then you can probably install it as a service with Srvany. It's been a while since I ran with activestate so my memory is failing me as to any other things you might need to do.

If all else fails you should still be able to run the raw SpamAssassin, but your script will need to be modified in order to do so.

GlenC wrote:I scanned through the tutorial and didn't see it. You should be able to test it by just running spamd in a dos box for now. ( spamd -D -u username ) When you know what command line options work best for you then you can probably install it as a service with Srvany. It's been a while since I ran with activestate so my memory is failing me as to any other things you might need to do.

If all else fails you should still be able to run the raw SpamAssassin, but your script will need to be modified in order to do so.

I must've done something wrong along the way. spamd and spamc both return "is not recognized as an internal or external command". spamassassin works from the dos prompt. I guess I assumed that spamc/d was created during the nmake step of the tutorial. I apologize for that.

I feel like I have wasted your time. You just made me remember that SpamD will NOT run with activestate perl without some pretty heavy modification. And you need to use a specially built version of SpamC too.

I feel like I have wasted your time. You just made me remember that SpamD will NOT run with activestate perl without some pretty heavy modification. And you need to use a specially built version of SpamC too.

I had run it this way for a while but had forgotten what all was involved to make it work.

No need to apologize. I appreciate all the help you are giving me.

Could I switch to cygwin? Is this practical? I have no other reason to have activestate on the server and only installed it for SA. I don't mind making modifications, etc. I'll do whatever it takes. I would like to have SA-learn running well, ultimately, I think.

Thanks again. I've worked in computer support for about 5 years. i know how these things go (my boss is not as patient but oh well). I have never dealt with perl and have installed SA once on a web server I lease (pretty straight forward in linux).

It appears that at least a few people have had good success following those instructions.

As for activestate, you should be able to just uninstall it. Just make sure that you remove the reference to c:\perl\bin in your path, I doubt the uninstall will do that for you.

One other thing that the How-to doesn't mention, but that I think probably needs to be fixed in the How-to... don't install it as the user "Administrator" I think spamd will refuse to run as that user.

It appears that at least a few people have had good success following those instructions.

As for activestate, you should be able to just uninstall it. Just make sure that you remove the reference to c:\perl\bin in your path, I doubt the uninstall will do that for you.

One other thing that the How-to doesn't mention, but that I think probably needs to be fixed in the How-to... don't install it as the user "Administrator" I think spamd will refuse to run as that user.

Excellent. I'm excited to make the change. Full functionality is key.

So do not install cygwin when logged in as administrator or does it ask what user to run under?

You can install cygwin for all users. But it won't ask what user to run it under. I don't know for sure it is a problem, but if you read the thread you will see that it appears that one person might have an issue trying to run it that way. To be safe, I would just avoid that and install it under a different windows user. On my machine, I installed it while logged in as GlenC, and then when setting up the scripts and services I used the "-u GlenC" option for spamd, spamc and sa-learn. You have some experience with Linux so you understand how the permissions and users and groups can get to be a PIA.

Edit: Note that I meant "Administrator" and not a "Member of the Administrator Group" which won't pose that problem.

I installed cygwin and have it up and running for now. I would like to add salearn, etc to script but that can wait. Thanks to all that helped. It's much appreciated. I will have no qualms about recommending hMailServer to others.

To stay on the current subject that this thread seems to have taken on, I tried to run SpamD in Cygwin and had some problems, as observed in the other thread. I gave up for a couple days and installed Active State Perl and ASSP, then came back to Cygwin because I was disappointed with ASSP and new that SpamD runs so much better in Cygwin than in Active State Perl.

I am currently running both Active State Perl and Cygwin fine. I imagine I may have to make sure that there are no conflicting instances of programs using the same filenames in both c:\perl\bin and c:\cygwin\bin sometime down the road if I decide to utilize any of them. I also had to disable the ASSP service in the MMC, but I didn't uninstall ASSP because you never know. I imagine if you have installed SA in both Cygwin and ActiveState Perl you will have to disable some services, rename some files or uninstall one or the other completely.

I am running hMailServer and SpamAssassin on Cygwin. I want to set it up so that any detected spam be moved to an IMAP folder for that account. I want to also set up a webmail app, any app, that will tie in to SpamAssassin as much as possible. Then allowing users to change SA config prefs all within the same webmail app would also be a plus. Anyone know how it is done?

webavant wrote:II want to also set up a webmail app, any app, that will tie in to SpamAssassin as much as possible. Then allowing users to change SA config prefs all within the same webmail app would also be a plus. Anyone know how it is done?

You can take a look here, there are some SM plugins and other options for configuring SA prefs. I would recommend going the SQL route so you don't end up with a bunch of user directories in your cygwin directory though. http://wiki.apache.org/spamassassin/WebUserInterfaces

You will need to parse the recipients list to get the users and run spamc for each recipient. I experimented with this a while back and was using something along the lines of this... you will need to clean this up to make it work properly I think:

Do you know why I keep getting blank email messages? Everything else works great. SpamAssassin has been installed properly and tested to work manually. But when I plug it into hMailServer, using either the scripting method or the External Virus Scanner, all I ever get is a blank email with NOTHING in it. No headers, no body, no nothing.

I've spent several hours trying to figure this out and I'm out of ideas.

"If it is not working and you are getting only blank emails in your inbox, check you have R64"

What do you mean, R64? Revision .64 of SpamAssassin? of hMailServer?... This line makes no sense to me...

I've installed SpamAssasin, i have made spamc.exe, and i've got the vbscript set up and configured to run as an External Antivirus, but all i get are BLANK EMAILS... No subject, no sender, no body... All blank.

Ok, upon closer inspection of this How To, i realize that what is meant to be done is modifying the C:\Program Files\hMailServer\Events\EventHandlers.vbs file, and uncommenting, and creating the Sub onDeliverMessage(oMessage) sub to have a value that does all the spam-checking...

But for the average reader it is extremely frustrating, and difficult to understand.

Could we please find an agreeable onDeliverMessage sub and re-post it as clear and precise as possible. And what would be even better would be to "Edit" the first post, so that the next user doesn't come up and start from square one, and have problems, then try cygwin, then realize they need to do a bunch of other crap, and then finally come to realize that they just need a few files and need to modify their EventHandlers vbscript...

That's just my opinion...

And i still cannot get the EventHandlers to do anything to spam. I've tried all of the vbscripts, but to no avail... Please help!

I still haven't gotten SpamAssassin to work. At the moment, it's not being utilized because all I get is blank emails.

I have successfully tested SpamAssassin by passing email into it manually and it spits back a modified email with the headers updated and such. Perl is in my command path. All seems well with the world.

The problem lies in the connection from hMailServer to SpamAssassin. I've tried many different variations... using both the Virus Scanner to call SpamAssassin and the EventHandlers.vbs. Neither makes any difference. I still get blank emails.

I've added debug output to figure out what's going on. All I can figure out is that SpamAssassin is NOT being called by hMailServer. The script blows right past the call to SpamAssassin and somehow ends up with a blank email.

I have confirmed that the script IS creating the email file and the temporary email file. I have even taken the email file in the directory where it's created and used the exact VBS code from my script to call SpamAssassin the same way (but doing it manually with a custom .VBS file) and it works fine: SpamAssassin is launched and a couple seconds later, it rewrites the email file with the spam headers. However, it fails when hMailServer tries to do it. There is no error whatsoever. I just get blank emails.

The only significant difference I can figure out between my setup and everyone else's is that everyone else seems to be using CygWin. Before I continue installing more and more stuff on my server, I was hoping I could get it to work without CygWin. Then, once that was working, I figured I would see how the performance was. Only then would I go the CygWin route... if the performance needed a boost. But maybe most others aren't seeing my problem because they're all blowing right past my basic setup and they're going straight to CygWin which might inadvertently fix whatever my problem is?? I don't know.

Here is the OnDeliverMessage() code I currently use. Keep in mind, I have used at least a dozen variations of this code, much of it taken from this form, and the result is always the same.

By the way, I have to second SoundOfEmotion's comment that the original post should be edited. I was also (and still am) very confused about the "R64" reference. I still don't know what that means! But from the post, it sounds crucial.

Though i would get everything marked as spam put into a seperate mailbox instead, so you can check it first before deleting it as you won't know if its really ham

John

Hi again,
I followed the entire thread through here - Spam Assassin 3.1 is running fine, hMail is processing mail & Spamassassin is marking mail up, but I cannot get mail to be deleted using John25UK's suggested method above. Can anyone assist with this please?

I changed the line mentioned above in sa.vbs, saved, rebooted the entire machine in case something was not taking immediate effect. Any assistance would be greatly appreciated. - Terry

It has been so long since I messed with that script from John25UK. The first thing you should check I suppose is to ensure you are using the "-e" switch on your call to spamassassin.

Make sure you changed the last line in the .vbs file from (7) to (rc)

Next, look in your logs (you may have to turn on debug logging and application logging) and make sure that "5" is the value being returned. The SpamAssassin docs say that using the "-e" switch will cause spamassassin to return a value > 0. I don't know where the "5" value came from. So look and see what the log says it is returning and try using that value.

Hi again,
Many thanks Glen, I will check that out. The script was definitely modified so that the last line is indeed changed to 'rc' instead of 7. I will have to check what values the server is returning.

The 0 is perhaps what the problem is. It's a shame that the web admin doesn't assist in changing or viewing the logs at this stage, because I will have to visit the client's office agan for this.

Hi again,
GlenC - the problem was very simply the fact that all changes had been made, including the last line to rc, but the changes had not been saved (where did I leave my head by the way?). After checking it had been saved now, everything is working as expected.

Just for everyone's information, SpamAssassin by default marks any value over 5 as 'spam=yes', so that's where the value comes from & that's what the script returns if it is spam. If the value is between 0-5, then it is not classed as spam & is passed through without issue. This is exactly the way SpamAssassin runs on *nix servers I administrate.

Anyone attempted to use this Win32 non-cygwin/non-perl version of Spamassassin? http://physics.ucsd.edu/~epivovar/anti-spam.htm... SpamAssassin for Windows (Win32), a native Windows build of spamassassin and spamd/spamc command-line tools. (Especially useful on mail servers.)...

fingers wrote:Anyone attempted to use this Win32 non-cygwin/non-perl version of Spamassassin? http://physics.ucsd.edu/~epivovar/anti-spam.htm... SpamAssassin for Windows (Win32), a native Windows build of spamassassin and spamd/spamc command-line tools. (Especially useful on mail servers.)...

I am trying to, i get everything working except having spamd running as a service.

it works perfect when i just start it by doubleclicking spamd.exe in the catalogue, but when i try to set it up as a service with srvany i cant get it to work.

anyone have got it working and can make a brief walkthrough?

EDIT: found the answer by googling a bit:

pop3proxy wrote:Hi, Yann! I am the guy who maintains spamassassin for windows. Found your post accidentally by googling...

I believe that the root of the problem is in the fact that my build of spamd finds all other files (in particular, the rules) relative to the current folder, unless you install it in the folder \usr. You should probably create a file spamd.bat and put two lines there

cd {full path to SpamAssassin for Win32 folder}spamd.exe

Then run this spamd.bat as a service. I have updated the Readme file so that now it explains that.

fingers wrote:Anyone attempted to use this Win32 non-cygwin/non-perl version of Spamassassin? http://physics.ucsd.edu/~epivovar/anti-spam.htm... SpamAssassin for Windows (Win32), a native Windows build of spamassassin and spamd/spamc command-line tools. (Especially useful on mail servers.)...

I am trying to, i get everything working except having spamd running as a service.

it works perfect when i just start it by doubleclicking spamd.exe in the catalogue, but when i try to set it up as a service with srvany i cant get it to work.

anyone have got it working and can make a brief walkthrough?

I've been Using - XYNTService.exe and it's Working Greate Have Had it running for 2+weeks and no mem leaks etc
uses about 48mb

------Start install.bat------@ECHO OFFECHO ----------------------------------ECHO Install SpamD as a Windows ServiceECHO ----------------------------------ECHO.ECHO.ECHO Make Sure you have edited ECHO \SA\XYNTService.iniECHO.ECHO Reflecting your Drive\Folder Location of SAECHO.ECHO And....ECHO.ECHO spamd.exe -i(Listening Network interface) 127.0.0.1 -A(Only Accept Connections From) 127.0.0.1ECHO.ECHO.pauseXYNTService.exe -iECHO Edit the Service Properties Before Continuing...ECHO.ECHO ie use a user and Password "that will be allowed to logon as a Service"ECHO Note: Make Sure it is An Existing UserECHO.ECHO Then, and Only Then, Continue to Run this Batch File to Start the SpamD_SVCECHO.pauseXYNTService -r SpamD_SVC------End install.bat------

Using this howto: I was able to get the basic spam assassin up and filtering

I continued reading down the tread and found some code for the eventhandler.vbs instead of the external virus scanner setup but it didn't seem that the author was too confident in the code at the time.

Is there some code that is accepted as good and stable for a fairly basic install of SA, I haven't tackled spamC/spamD and I still have a lot of sorting to do before I can have bayes working well.

Since OnDeliverMessage checks both incoming and outgoing messages, Martin had made a suggestion to check the From header before running the spam check. However, I'm finding a lot of spam with bogus headers saying they are from the person they are trying to send to.

Is there - could there be - a message property that OnDeliverMessage could check which is which IP Range the message is coming from? That would be checking the data I am interested in, rather than trying to find a surrogate for it.

' Received header RegEx strings For local mail' cRecHdr1 will match any mail sent from a local source other than hMailServerconst cRecHdr1 = "(Received\: from ((\[192\.168\.1\.[0-9].*\])|hostname.|hostname) \(.(192\.168\.1\.[0-9].*|127\.0\.0\.1).\))|(Received\: from domain\.tld \(\[127\.0\.0\.1\]\))"' cRecHdr2 will match on warning mails generated by hMailServerconst cRecHdr2 = "(Message-ID: <.*@host\.domain\.tld>)"

If it matches either of these it's local so doesn't need to get checked by SA.
HTH
--
Regards
Barry

many thanls for all your help and all the tips supplied in this post.... i actually installed spamassassin, making it work first by the mean of the external virus scanner and the by the scripts.

my question : with the external virus scanner i could delete the mail easily, i made a rule in hmailserver to delete each taged mail.

with the scripts it is not possible if i use the ondelivermessage, the rules are not applied. so i had to put SA in the onacceptmessage, wich cause delays...

what could i do as a better solution to have the spam directly deleted?

EDIT: another problem is that i had to desactivate spamassassin check because my computer was freezing each time a large e-mail was checked....... any way to handle that ? help would be much appreciated.

prolifix: No, my COM object does not support sending a username. I assume you are asking about the username field because you want to do per user rules in SA. I do not set up per user rules in SpamAssassin.

I do my spam thresholds on a per user basis on the email server side, because it is much easier to manage. In our environment, we have a load balanced cluster of SA boxes. It is not really practical to maintain per user rules on each SA box and we do not want the SA boxes to need to share a MySQL instance because that would be a single pont of failure.

The most useful per user rule is the SA threshold. And that is implemented in the email server VBS script, so each user can have his/her own custom threshold.

remyb: Are you trying to run spamassassin on the same box as hMail? I've tried that in the past but the performance is terrible that way. You really need to set up SpamD on a separate box and then connect to it from the hMail box using TCP. This will relieve the strain on your email server. If you need even more performance, set up a load balanced cluster of SpamD boxes. When we retire old web server, we format the old boxes and set them up in our SpamD cluster. It is an excellent way to recycle old hardware.

schworak: I created a poll regarding how I think SA should be integrated into hMail. I think the SpamC section of the code should be integrated but NOT the main SpamAssassin or SpamD section of the code. With the SpamC code (which is extremely tiny and very effecient) integrated into hMail, it would be very easy for people to connect to SpamD instances.

Error 800403E9 - No access to this property/method. Ensure that hMailServer.Application.Authenticate() is called with proper login credentials.

And also, the Spamassassin for Win32 seems to run so so much better than the Perl version which took ages to install, and even then it generated blank messages even after hours of tinkering with its settings.

For anybody, who do not want to install and configure Perl or Cygwin I can recommend sawin32 (see Sourceforge). Project consists of standalone .exe files, configuration is very easy, spamd can be easily run as service using srvany.exe and instsrv.exe. I have not found any problems running this version.

As far as I understand it, all they did with sawin32 was tweak the Perl code a little bit and then use a Perl to EXE compiler to generate the EXE files with the Perl libraries and executable built it. It is a bloatware approach. I think it is a decent solution for small volumes of email.

For higher volumes, run SpamD on FreeBSD or Linux and connect to SpamD using spamc.exe (the one compiled using C) or my COM object. SpamAssassin was written for Unix, and it was tested for Unix. You can get it to work on Windows, but the application does not perform well on Windows. It is just not written to properly take advantage of Windows. It is really written with Unix in mind.

Additionally, the sawin32 version is not written for Windows and tweaked to get the most performance possible with Windows. The sawin32 version is just a port with some of the obvious bugs corrects and Perl compiled into it. A true Windows port could perform much better than sawin32. I have nothing against sawin32, but I would not recommend it for anybody that has to process a lot of email.

simbolo wrote:I tried the above script and an error was generated in the log:

Error 800403E9 - No access to this property/method. Ensure that hMailServer.Application.Authenticate() is called with proper login credentials.

And also, the Spamassassin for Win32 seems to run so so much better than the Perl version which took ages to install, and even then it generated blank messages even after hours of tinkering with its settings.

3 general SA questions:
1)
I've got c:\sawin\SpamAssassin-win32\etc\spamassassin where the local.cf is located. Are the .cf files in c:\sawin\SpamAssassin-win32\share\spamassassin loading automatically?

2)
How do I set SA to German so that the texts in 30_text_de.cf are used.

3)
I've set the update like this: sa-update.exe --nogpg --updatedir \sawin\SpamAssassin-win32\share\spamassassin\
But in this directory a \updates_spamassassin_org is created. Can't I just update to \sawin\SpamAssassin-win32\share\spamassassin\ somehow or is there a reason that the subdir is created?

Sorry - I'm a newbie to the SA

[edit]: Noone answers so I'm on myself - like allways:

1) yes

2) It's a bug in the latest version

3) The files are used, even if the foldername is "updates_spamassassin_org..."

I cannot access the how to on link number 6, does anyone have it saved on their computer or know what to do to install spam assasin from scratch, I also am trying to hunt down help installing squirlmail too.
thank you.

There is one problem though, when I check my mail through the web-interface (squirrelmail) all the e-mails have no subject and no content...
This is very weird because when I download the e-mail through POP it's all fine.

he also helped me further to set it up, below is a script I ended up with, I've setup 2 email addresses, first is to be intentionally spammed, no legitimate email ever will make it to this email address, second is for forwarding spam emails missed by Spamassassin in this setup as attachments.

Could you guys review it, and possibly I would also like to delete the emails permanently that are going to the 2 accounts, I am still not sure how to do that right...

As far as I can tell it works, however since there is no way to get the success notice out of SA-learn as far as I can tell, I tried the piping I also tried --dump, but without success, perhaps someone with SA-learn experience could show us how to get some feedback to see if learning took place?

I made some changes to capture the Debugging info and now I get this in the log:

using above script I posted before, I added a few lines to it and a new header in spamd configuration, however, the message object in script doesn't have the new headers, is there a way to re-read the email modified by spamassassin to get those headers or any other way?

I know i could construct some fso little script to read and parse the new email file saved by spamassassin but that would be resources problem...