XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum -> Spamassassin For Win32 Systems

Closed TopicStart new topicStart Poll

> Spamassassin For Win32 Systems
hschneider
Posted: Sep 11 2003, 05:54 PM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



E.g. with a custom script hooked into filters.in.tab. It scans the header for Spam Assasin's tags and, moves the message to the appropriate user's diectory. Then it stops the message's further travel by return code.



--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
stealth
Posted: Sep 12 2003, 08:27 AM
Quote Post


Newbie
*

Group: Members
Posts: 8
Member No.: 726
Joined: 11-September 03



Yes, that is what I figured out myself.
But I haven´t got a clue on how to make such a script.
The readme does not help me with that.
PMEmail Poster
Top
hschneider
Posted: Sep 12 2003, 08:44 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



You can use any programming language for "scripting". You just need to parse the command line arguments and set the proper return codes.

If you are not used to program, please set your request into the scripting corner here.



--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
bim
Posted: Sep 23 2003, 08:15 PM
Quote Post


Advanced Wizard
**********

Group: Members
Posts: 489
Member No.: 297
Joined: 6-October 02



Not much of an update, but I like the feature and I guess those who don't know any Perl will appreciate not having to code even this one line of Perl smile.gif:

I want to be able to instantly see which message is spam and which isn't. Changing the subject seemed like the best way to do this. I changed


QUOTE

if ($checkedEmail=~/X-Spam-Flag: YES/) {
$isSpam="SPAM";
#$checkedEmail=~s/(?<!\r)\n/\r\n/g;
$xmailHeader=~s/(?<!\r)\n/\r\n/g;
}

into
QUOTE

if ($checkedEmail=~/X-Spam-Flag: YES/) {
$isSpam="SPAM";
#$checkedEmail=~s/(?<!\r)\n/\r\n/g;
$xmailHeader=~s/(?<!\r)\n/\r\n/g;

#modify subject
$checkedEmail =~ s/\nSubject: /\nSubject: [spam] /i;
}


This way every message that is marked as spam bij SA will have a subject that starts with [spam].
PM
Top
whitedaisy
  Posted: Oct 14 2003, 08:58 AM
Quote Post


Newbie
*

Group: Members
Posts: 6
Member No.: 763
Joined: 14-October 03



I am running with Windows 2003. No problems per say yet. I am currently in the process of rewriting the filter provided by Don Drake (thanks!!!) to be more optimized for Windows since we don't have the use of SPAMD and SPAMC yet.

SA_Filter_Opt.zip

I've attached the optimized filter as well as some performance results I have collected in the past day or two (I'll send them again after a full week) - basically the new filter is running 40% or so faster (so far) - primarily because it uses the SpamAssassin API directly instead of calling out via system(). When system() is called it launches the .BAT file in the perl directory, then it launches perl.exe again. In effect your process tree ends up looking like this (using tlist.exe):

XMail.exe (680)
  perl.exe (1340)
        cmd.exe (744)
            perl.exe (2112)
    perl.exe (964)
        cmd.exe (2144)
            perl.exe (2152)
    perl.exe (2048)
        cmd.exe (2056)
            perl.exe (2120)
... etc

Instead of like this as you would want:
XMail.exe (680)
    perl.exe (1340)
    perl.exe (964)
    perl.exe (2048)

The use of memory was killing my server even though I run with 512 MB of ram. A secondary advantage of using SpamAssassin in this way is you can make different decisions about what to do with spam by using the instance of the status returned by check_message() or check_message_text(). Another interesting option might be to generate domain SpamAssassin prefs on the fly (like turning the threshold down to 5 or something like that), and passing them in via the factory constructor.

Note that I am using an older version of XMail so you will have to adapt the code to the newer return codes. Let me know if there are further ways to optimize this code that you see....we need the assassin to slice faster dry.gif
PMEmail PosterUsers Website
Top
whitedaisy
Posted: Oct 14 2003, 09:03 AM
Quote Post


Newbie
*

Group: Members
Posts: 6
Member No.: 763
Joined: 14-October 03



QUOTE (bim @ Sep 23 2003, 08:15 PM)
Not much of an update, but I like the feature and I guess those who don't know any Perl will appreciate not having to code even this one line of Perl smile.gif:

I want to be able to instantly see which message is spam and which isn't. Changing the subject seemed like the best way to do this. I changed


QUOTE

if ($checkedEmail=~/X-Spam-Flag: YES/) {
$isSpam="SPAM";
#$checkedEmail=~s/(?<!\r)\n/\r\n/g;
$xmailHeader=~s/(?<!\r)\n/\r\n/g;
}

into
QUOTE

if ($checkedEmail=~/X-Spam-Flag: YES/) {
$isSpam="SPAM";
#$checkedEmail=~s/(?<!\r)\n/\r\n/g;
$xmailHeader=~s/(?<!\r)\n/\r\n/g;

#modify subject
$checkedEmail =~ s/\nSubject: /\nSubject: [spam] /i;
}


This way every message that is marked as spam bij SA will have a subject that starts with [spam].

If I understand what you are trying to do here - it can be accomplished in SA's local.cf by using these two lines:

subject_tag *****SPAM*****
rewrite_subject 1
PMEmail PosterUsers Website
Top
bim
Posted: Oct 27 2003, 01:42 AM
Quote Post


Advanced Wizard
**********

Group: Members
Posts: 489
Member No.: 297
Joined: 6-October 02



QUOTE (whitedaisy @ Oct 14 2003, 09:58 AM)
SA_Filter_Opt.zip

I tried unpacking that zip-file, but got an error message both with WinRAR and the WinXP build-in unzipper that there were no files to unpack. Something wrong with the file?
PM
Top
whitedaisy
Posted: Oct 28 2003, 12:31 AM
Quote Post


Newbie
*

Group: Members
Posts: 6
Member No.: 763
Joined: 14-October 03



I have reposted the zip file - I believe the old one was corrupted for some reason. I have also included a log file with a run using the original sa_filter.pl and the sa_filter_optimize.pl.

I collected stats for over a week of use, the final outcome was an approximate 30% increase in performance instead of 40% as previously reported - still well worth the change.

OptSpamAssassin.zip

Let me know if anyone has comments.

Thanks,
-aaron

PMEmail PosterUsers Website
Top
bim
Posted: Oct 29 2003, 04:55 PM
Quote Post


Advanced Wizard
**********

Group: Members
Posts: 489
Member No.: 297
Joined: 6-October 02



Thanks!

I hope you don't mind, I've been playing with it myself. If you have any comments, let me know!
download...

Important notes:

1. You'll need to install Config::Fast. at the DOS-prompt:
CODE

ppm
install Config::Fast

If you know of a better way to read config files, let me know!

2. I didn't want to check spam on every e-mail address and I want to be able to set-up different ways of working for different accounts. This version will ONLY check mail if the file SAFilter.cf is present in the mail folder (where also user.tab resides). Mails for other accounts aren't checked. This file can be empty, but if you put for example
MinHitsForDelete 10
in it, mails with over 10 hits will be returned to the sender

3. At the start of the script, don't forget to change the paths to both XMailserver and Perl! Also change SA_VERSION_HEADER. This is the complete line from the header that SpamAssassin adds to every e-mail it has checked.

4. Exit codes are for XMailserver 1.16 and above. I only tested with XMailserver 1.17. With this version adding
"*" "*" "0.0.0.0/0" "0.0.0.0/0" "safilter.tab"
to filters.in.tab did the trick, also for e-mail that gets forwarded. I however seem to remember that in 1.16, forwarded e-mail was only filtered with filters.out.tab



Might be interesting if you want to further optimize your own script: I noticed that e-mail that gets forwarded to an other account within the same server is checked twice. So I first check if the SpamAssassin header is present. If it is, the mail isn't checked anymore.

Give it a try an let me know what you think of it!
PM
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Documentation and Knowledge Base | Next Newest »

Closed TopicStart new topicStart Poll