Before you do too much work you should probably check out: http://spambayes.sourceforge.net/
There has already been a lot of work done on this project. FYI, Larry David MacQuigg wrote: > Are you as mad about spam as I am? Are you frustrated with the > pessimism and lack of progress these last two years? Do you have > faith that an open-source project can do better than the big companies > competing for a lock-in solution? If so, you might be interested in > the Open-Mail project. > > I'm writing some scripts to check incoming mail against a registry of > reputable senders, using the new authentication methods. Python is > ideal for this because it will give mail-system admins the ability to > experiment with the different methods, and provide some real-world > feedback sorely needed by the advocates of each method. So far, we > have SPF and CSV. See http://purl.net/macquigg/email/python for the > latest project status. > > I welcome anyone who is interested in helping, expecially if you have > some experience with mail transfer programs, like Sendmail or Postfix, > or spam filtering programs, like SpamAssassin. My Python may not be > the best, so I welcome suggestions there also. We need to make these > scripts a model of clarity. > > -- > Dave > -- http://mail.python.org/mailman/listinfo/python-list