[Spambayes] Questions about IMAPFilter

Tony Meyer tameyer at ihug.co.nz
Tue Jul 20 02:28:40 CEST 2004

> Here is my situation: I'd like to be able to run 
> sb_imapfilter.py as a service or a cron job when the 
> Administrator is logged out. Has anyone been able to do this 
> with any of the various W32 cron tools, or with something 
> like FireDaemon?

How familiar are you with Python?  In the windows directory of the source
archive there's a script called "pop3proxy_service.py" which basically turns
the sb_server.py script into a Windows service.  It shouldn't be too
difficult to write an imapfilter_service.py script that does the same thing
for sb_imapfilter.py, based on that example.  (If you do do this, then
contributing the code back would be fantastic!).

> I've tried Pycron, which has no problem executing the 
> sb_imapfilter.py script, but it looks like when it is run via 
> Pycron, it's not selecting the correct profile, and therefore 
> does not work. Is this something that can be defined from the 
> command line, or hard-coded into the script?

I don't know what Pycron allows (if it is an actual service, then you can
choose which account it uses).  However, I presume that all you care about
is that it can find the configuration file & databases.  The locations of
the databases can be changed (via the web interface or just manually in the
configuration file) to whatever you like.  If you give a relative path then
it's taken relative to the configuration file; if you give an absolute path,
then it's just that.  To find the configuration file, SpamBayes looks for an
environment variable BAYESCUSTOMIZE holding the full path to the file, then
in the current working directory (maybe Pycron can set this?), then, on
Windows, in the {Application Data}\SpamBayes\Proxy directory.  The easiest
solution would be to set the environment variable.

=Tony Meyer

Please always include the list (spambayes at python.org) in your replies
(reply-all), and please don't send me personal mail about SpamBayes. This
way, you get everyone's help, and avoid a lack of replies when I'm busy.

More information about the Spambayes mailing list