Hello all,

I am actually writinghave written a milter with Python that can be
useful, especially if you are using the Sieve filters. It is written
for SOGo, but it should be very simple (even simpler) to translate into
RoundCube address books.

This is a very simple milter, written in Python, that do the
following when a new message arrive.

1. Get the recipient uid "UID" from the email address.
2. Get the list of address books in the database for the user with uid
"UID"
3. Search the sender email address in all the user's address books
4. If found at least one, add one header "X-AddressBook" which contains
a list of all the address books found, with a prefixed syntax:

X-AddressBook: "SOGo:Personnal, SOGo:Professional"

So, in the case of RoundCube, the plugin would use RoundCube prefix,
but the same principle.

There are some limitations, of course, but it is still functional.

- Once active, sieve filters should be simpler, no need to have a long
list of from email address, just create an address book, and a put your
contacts in it.

- You can create a different automatic responder for each address book.

- Because I am using this on Debian Stretch for now, I am using the
available version of python-milter, which uses python2. When I will
port this to buster, I will use the python3-milter package. I tried to
made it compatible with version 3 as much as I could.

- This is freshly new, and has not been tested in production yet. I am
working on it.

- You can test the behaviour using an SQLite database. Because my first
idea was to use a global sqlite database synchronised with multiple
address books, it was supposed to contain not the email address but a
hash (sha256).

- I am not a Python expert, and perhaps there are some errors in the
code, but it should be readable. I had to disable a few pylint
warnings, as I could not solve them at all, especially those related to
the inherited class.

- This is the first time I am writing a milter script, be indulgent.

The code:

https://github.com/progmaticltd/sogo-milters/blob/master/milter-abook/milter-abook.py

I initially wrote this for HomeBox, I may add some documentation for
the deployment if needed.

Kind regards,
André
_______________________________________________
Roundcube Users mailing list
[email protected]
http://lists.roundcube.net/mailman/listinfo/users

Reply via email to