I am looking to do various email processing - for example. check the headers and if they meet some criteria (see spam), release the connection or browse the list of recipients and perform special filtering.
It looks like the Python smtpd library provides a convenient and simple interface for processing the received message.
To process a message before it is fully processed (for example, to delete a message if the headers look like spam), should handle_connect be used? Has the internal API been documented somewhere (other than process_message)? Sample code anywhere?
Also, has anyone used smtpd in production? Any thoughts on reliability, etc.
Regarding Twisted: I tried using Twisted several times and is very similar to a deferred model, but it's too complicated for my current taste. I'll give him another look, but for now I'm more interested in non-twisted implementations.
source share