[Pymilter] minimal working example of pymilter script
André Rodier
andre at rodier.me
Sun Oct 27 16:24:34 EDT 2019
On Sun, 2019-10-27 at 11:48 +0100, Fourhundred Thecat wrote:
> Hello,
>
> I would like to process mail that arrives at my Postfix server via
> smtpd
> (SMTP-only filter).
>
> I am new to milters, and I am looking for simplest possible working
> example of a python3 pymilter script. Something that does nothing
> useful, perhaps just adds "hello world" at the beginning of the
> message
> body.
>
> All the examples that I could find online are overcomplicated and
> incomprehensible to my beginner self.
>
> Could some kind person link me to a minimal working example of
> pymilter
> script ?
>
> thanks,
Hello,
I had the same issue, but I found some help in the python-milter
library.
If you want a sample code, on github:
https://github.com/progmaticltd/homebox/blob/dev/install/playbooks/roles/roundcube-milters/files/milter-abook.py
This is not a Hello world, but the code is clean, and you can easily
remove the specific code.
This milter search for the sender in the user's address book in a
RoundCube database, and insert a header accordingly. For instance:
X-AddressBook: RoundCube: Default
Good luck!
Kind regards,
André
More information about the Pymilter
mailing list