[Pymilter] simple milter design needed

Stuart D. Gathman stuart at bmsi.com
Sat Apr 3 18:24:49 EST 2004


On Sat, 3 Apr 2004, Stuart D. Gathman wrote:

>     # pass modified message to sendmail
>     out = StringIO.StringIO()
>     try:
>       msg.dump(out) # flatten modified message
	...
>       return Milter.CONTINUE
>     except:
>       return Milter.TEMPFAIL
>     finally:
>       out.close()

Above based on code that normally uses a temp file to handle large emails.
Doing it all in memory could be as simple as:

     # pass modified message to sendmail
     newhdrs,newbody = msg.as_string().split('\n\n',1)
     self.replacebody(newbody)

-- 
			Stuart D. Gathman <stuart at bmsi.com>
      Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
      "Very few of our customers are going to have a pure Unix
      or pure Windows environment." - Dennis Oldroyd, Microsoft Corporation




More information about the Pymilter mailing list