[Exim] avoiding duplicate deliveries in pipe transport

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Christian G. Warden
Date:  
À: exim
Sujet: [Exim] avoiding duplicate deliveries in pipe transport
I'm trying to archive all mail sent by authenticated users.
This is my first router:

archive_by_sender:
driver = redirect
condition = ${if def:authenticated_id{yes}{no}}
data = ${lookup mysql{ ... }}
directory_transport = deliver_to_mailbox
unseen
no_repeat_use
no_verify

The lookup generates a directory of the form /user@???~mailbox/ which
the deliver_to_mailbox transport splits up and passes to a pipe command.

deliver_to_mailbox:
driver = pipe
batch_id = $address_file
batch_max = 10000
command = /usr/sbin/deliver -m ${substr_-1:${extract{2}{~}{$address_file}}} -u ${substr_1:${extract{1}{~}{$address_file}}}
delivery_date_add
envelope_to_add
return_output
return_path_add
user = delivery
group = delivery

The problem is that there is a delivery per recipient instead of per mailbox.
According to chapter 24 of the docs, addresses in which batch_id expands to the
same value will be batched together and the Envelope-to: header will contain
all batched addresses. Instead, I'm getting separate deliveries with identical
messages except for the Envelope-to: header.

Am I doing something wrong in batching? Using -d+transport doesn't seem
to give any information about testing the batch conditions.
There isn't a way to make a router run once per message rather than once
per recipient, is there?

Thanks,
xn