The current event log is cumbersome to use for
gathering statistics, because events must be collated
by connection and mailfrom. The close callback is
called for every connection. It should write a single
line for every message (in conjunction with the
mailfrom callback for multiple messages on the
connection). This line should have fields for things
we want to count. Identifying those fields will take
some thought. Here are some ideas:
MFROM domain - for reputation stats
SPAM/HAM status - for reputation stats
Reason - why message was rejected and/or flagged as spam:
content, helo forged, mfrom forged
SPF result
RCPT - can delay forgery rejects until RCPT TO to
capture that info. Will require rejecting all RCPT TOs
to finally reject the message.
Logged In: YES
user_id=142072
By abandoning support for python2.2, we could use the
logging module. That should also solve the problem of
syncronizing the log between threads without reinventing the
wheel.