[Pymilter] Unknown command and further processing

Stuart D Gathman stuart at bmsi.com
Wed May 23 15:17:56 EDT 2012


On 05/23/2012 03:12 PM, Larry G. Wapnitsky expounded in part:
>
> OK, so here's the issue.
>
> My original milter would "crap out" when an unknown command was sent 
> to Postfix.  That milter is designed to remove attachments from a 
> message, save them and replace them with a single HTML file pointing 
> to where the attachments have been saved.  I was never able to 
> diagnose why until I saw the postfix logs having Unknown commands at 
> the exact same time as the message was received.  I started logging 
> these and, lo and behold, coincidence.
>
> Now, I have a milter that comes before my original that just passes on 
> e-mail with unknown commands, but logs when they occur, to whom they 
> were sent, etc.
>
> I've just written yet another milter (evolved from the original) that 
> I want to call when the unknown commands are hit.  This one would log 
> the headers, et. al. to a database, with the attachments as blobs.
>
> My concern is that this one will fail as well.  How do I tell my 
> milter to only to the DB stuff if the unknown command is received?  
> Should that be  a true/false value as the trigger when unknown is hit?
>
> Let me know if you'd like to see the code to my milters for clarification.
>
>
Sure, just set a flag in the unknown callback, and log headers and body 
only when hitting that.

You could also just set a flag in your original milter, and avoid 
rejecting the message in later callbacks.

It is not clear that you have verified whether postfix does indeed go on 
processing the mail after seeing an unknown command.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gathman.org/pipermail/pymilter/attachments/20120523/1ee823ee/attachment.html>


More information about the Pymilter mailing list