thanks for the suggestions, this is not happening frequently, actually this is the first time I have seen this exception in the system, which means that some spam message was generated with ill-formated html. i guess the best way would be to check using regular expression and delete the unclosed tags.
-- http://mail.python.org/mailman/listinfo/python-list