[Spambayes] Use of email package

Barry A. Warsaw barry at python.org
Wed Feb 19 12:18:07 EST 2003

>>>>> "TS" == Tim Stone <tim at fourstonesexpressions.com> writes:

    TS> We've got to either seriously harden our code so it knows what
    TS> to do when the email package raises an exception, or consider
    TS> not using the email package.  I think I'll be reworking
    TS> pop3proxy so that it no longer uses the email package for
    TS> anything.  The Corpus stuff currently has most (all?) the
    TS> function that is needed by pop3proxy anyway.

Let me take this opportunity to elaborate on the architecture of the
email package.  There was a deliberate separation between the
representation of email messages and the parsing of flat text to that
object model (and in generating flat text from the object model, but
that may not be relevant).

Thus, it was designed with an eye toward the use of application
specific parsers, and it may well be that the default parsers (both
the strict and the lax parsers) may not be appropriate for an
application that tends to see intentionally ill-formed messages.  My
suggestion would be to write a parser that can handle the really bad
messages, then use the default lax parser for most things, and fall
back to the "adaptive parser" for the really horrendous messages.

Then donate that parser back to Python. <wink>


More information about the Spambayes mailing list