The Artima Developer Community
Sponsored Link

Python Buzz Forum
XMail Spambayes

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ng Pheng Siong

Posts: 410
Nickname: ngps
Registered: Apr, 2004

Ng Pheng Siong is just another guy with a website.
XMail Spambayes Posted: Oct 4, 2004 6:37 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Ng Pheng Siong.
Original Post: XMail Spambayes
Feed Title: (render-blog Ng Pheng Siong)
Feed URL: http://sandbox.rulemaker.net/ngps/rdf10_xml
Feed Description: Just another this here thing blog.
Latest Python Buzz Posts
Latest Python Buzz Posts by Ng Pheng Siong
Latest Posts From (render-blog Ng Pheng Siong)

Advertisement

Who are these people who send me mail: ulycufueohvx@proxad.net, dndpfk@anet.net, ltw707oga@chollian.net?

XMail offers a mechanism to run message filters during an SMTP session. There are several XMail filters available that invoke SpamAssassin, written in Perl, and one that does SPF, written in Python.

It is quite easy add to an SMTP filter to XMail. Here's my Spambayes filter which took just several minutes to write, and I've never seen Spambayes before this. It seems to work, too.

#!/usr/bin/env python

import sys
from spambayes import hammie

hammie_db = '/usr/local/pkg/xmail/hammie.db'

REJECT = 3

def main(argv):
    if len(argv) != 2:
        sys.exit(0)
    filter = hammie.open(hammie_db)
    spam_prob =  filter.score(open(argv[1]))
    if spam_prob >= 0.5:
        sys.exit(REJECT)
    
if __name__ == '__main__':
    main(sys.argv)

hammie.db is the output of sb_mboxtrain.py.

If the filter finishes with exit code 3, XMail drops the message without spooling it to the user mailbox; any other exit code causes XMail to accept the message. A filter may modify the message data, e.g., do the regular Spambayes thing of adding an X-Spam-BlahBlah header.

To turn the filter on, edit the file filters.post-data.tab thusly:

"/usr/local/bin/sb_xmail.py"    "@@FILE"

Read: XMail Spambayes

Topic: Emergency Maintenance Previous Topic   Next Topic Topic: Back in business

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use