1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Advanced content filter for Postfix using spawn service

Discussão em 'Python' iniciado por Stack, Setembro 10, 2025.

  1. Stack

    Stack Membro Participativo

    As stated in the Postfix Filter Readme, I would like to make a filter for the spawn service, preferably in Python, which I can define in master.cf like this:

    /etc/postfix/master.cf:
    # ===================================================================
    # service type private unpriv chroot wakeup maxproc command
    # (yes) (yes) (yes) (never) (100)
    # ===================================================================
    localhost:10025 inet n n n - 10 spawn
    user=filter argv=/path/to/filter localhost 10026


    So in case the mail is not bounced, it will inject the mail back to Postfix on port 10026.

    An alternative to the spawn service, is running a standalone smtp daemon, for instance on port 10025. I've found this example that is using Python's smtpd.SMTPServer. That seems to be working OK, but I would prefer the spawn-method because I don't want to manage the daemon myself, like ensuring it is still running correctly.

    I cannot find that much information about the Postfix spawn service and how I should implement a filter for it. What would be (the format of) the input (commands) for such a filter? Can someone provide an example, preferably in Python?

    Continue reading...

Compartilhe esta Página