Re: [exim] Adding headers for mail tap

Top Page
Delete this message
Reply to this message
Author: Marc Sherman
Date:  
To: exim-users
Subject: Re: [exim] Adding headers for mail tap
Philip Hazel wrote:
>
> But I wasn't thinking straight. Doing that would lose the recipient
> addresses (by dropping duplicates). However, I've thought of what the
> right way to do this is. Use the same router you are using now, but
> route the messages to a special appendfile transport that has
> batch_max=100 (or some other large number). That should then handle many
> addresses at once and create only one copy of the message, with all
> recipients in a header (or you can use BSMTP).


Thanks for looking into that, Philip. I tried setting batch_max (and
removing $local_part from the debug_print) in the transport, but it
still delivered multiple copies of the message. Finally I ended up
going with the redirect to a dummy address for deduping, and that
worked. Here's the final config I ended up with:

spam_quarantine:
  debug_print = "R: spam_quarantine for $local_part@$domain"
  driver = redirect
  verify = false
  condition = $ACL_MSG_QUARANTINE
  user = msherman
  group = msherman
  directory_transport = local_spam_quarantine
  data = ${if \
    eq{$local_part@$domain}{spam_quarantine_dedupe@???} \
    {/home/msherman/Maildir/.Spam.Quarantine/} \
    {spam_quarantine_dedupe@???}}


local_spam_quarantine:
debug_print = "T: local_spam_quarantine for all addresses"
driver = appendfile
maildir_format
delivery_date_add
envelope_to_add
return_path_add
maildir_tag = :2,S
batch_max = 100

Note that I was mistaken earlier when I said I needed to guess at the
RCPT addresses -- envelope_to_add is putting them in the headers, so I
have them available. And it is doing the right thing in this
configuration, as documented, combining all redirected recipients into a
single comma-separated list in the header.

> I have NOT tested this (I'm at home, it's a holiday), and it might not
> work at the moment (though I know it does work for pipes). But if it
> doesn't work, it is perhaps something that should be made to work.


If you can see anything in my config that would have caused it to not
dedupe the deliveries when the data option in the router was just
"/home/msherman/Maildir/.Spam.Quarantine/", please let me know;
otherwise, I guess this should go in the bugzilla or wishlist. Either
way, its working for me now, and all the complexity is localized to a
single data option in the router, so I'm not at all unhappy with this
solution.

Thanks for the help, and happy easter,
- Marc