Ok, so far I've figured out this:

I added this to the main.cf :

smtpd_milters = inet:localhost:12000

milter_protocol = 6


I used the example script of ppymilter from the Wiki (
https://code.google.com/p/ppymilter/wiki/PPyMilter)

I only modified it to to use tcp port 12000:

#!/usr/bin/python

import asyncore
from ppymilter import ppymilterbase, ppymilterserver
# (or just "import ppymilterbase, ppymilterserver" depending on your
#  sys.path)

class NoBccMilter(ppymilterbase.PpyMilter):
  def __init__(self):
    ppymilterbase.PpyMilter.__init__(self)
    self.CanAddHeaders()
    self.__mutations = []

  # obviously this doesn't work (well) with mail groups
  def OnRcptTo(self, cmd, rcpt_to, esmtp_info):
    self.__mutations.append(self.AddHeader('To', rcpt_to))
    return self.Continue()

  def OnEndBody(self, cmd):
    tmp = self.__mutations
    self.__mutations = []
    return self.ReturnOnEndBodyActions(tmp)

  def OnResetState(self):
    self.__mutations = []

if __name__ == '__main__':
  ppymilterserver.AsyncPpyMilterServer(12000, NoBccMilter)
  asyncore.loop()

Change permissions to 700 and ran the script. It gave no errors, which is
good. However, using ss to check which ports are in use doesn't show port
12000(Which I would expect)

I see no message whatsoever in /var/log/maillog that the milter is used. Am
I missing something ?

cheers,

Andy







2015-01-08 15:20 GMT+01:00 Andy Kannberg <andy.kannb...@gmail.com>:

> Hi,
>
> I am looking how to use ppymilter in Postfix. Using pymilter is explained
> in the Postfix docs ( http://www.postfix.org/MILTER_README.html#config )
> , but I can't find how to do the same for ppymilter. Anyone can send me in
> the right direction ?
>
> cheers,
> Andy
>

Reply via email to