We've successfully written milters (Google pymilter) that check a MySQL
database to accept inbound mails for anyone who is in this client's CRM
system. Since the postfix box is a front-end to an Exchange server, the
milter triggers a FILTER relay:192.168.x.x response to pass the email to
Exchange without any further processing.

If your CardDav server is local, and uses MySQL as the backend, it's
easier to have a milter query MySQL directly. Depending on the size of
the DB, you will need to do some query optimization, get your indexes
set properly, etc... that will lower the query times and not add much
latency.

Our milter queries a 250K row table of contacts in 10ms, which adds
around 30ms latency to the inbound email based on log times.

If we had to do that over http with a multi-round trip 401 authorization
and / or oath, that latency would skyrocket by comparison.

My two cents.

Michael Munger, dCAP, MCPS, MCNPS, MBSS
High Powered Help, Inc.
Microsoft Certified Professional
Microsoft Certified Small Business Specialist
Digium Certified Asterisk Professional
mich...@highpoweredhelp.com <mailto:mich...@highpoweredhelp.com>
On 03/12/2018 04:20 AM, André Rodier wrote:
> Hello Bastian,
>
> Thanks for the advice, I will consider it. I am pretty sure to know how to do 
> this.
>
> However, because the CardDav server is on the same host, I think it should 
> not be an issue. 
>
> I made a few tests, and the performances are even better than some anti-spam 
> milters like SpamAssassin...
>
> The other reason is I want to add headers to the email, and let the users 
> decide how they want to process personal emails.
>
> Perhaps I can add headers with a global sieve filter as well, and have the 
> same result.
>
> André.
>
> On 12 March 2018 05:20:00 GMT+00:00, Bastian Blank 
> <bastian+postfix-users=postfix....@waldi.eu.org> wrote:
>> On Fri, Mar 09, 2018 at 11:53:00AM +0000, André Rodier wrote:
>>> I would like to know if there is any milter for postfix that would
>> let
>>> me query a CardDav server?
>> Well, don't.  Milter is latency sensitive and it will break mail
>> delivery if you don't manage to get it right.
>>
>> If you use the correct Sieve implementation you can ask it to run stuff
>> for you:
>>
>> https://raw.githubusercontent.com/dovecot/pigeonhole/master/doc/rfc/spec-bosch-sieve-extprograms.txt
>>
>> Bastian

Reply via email to