[Exim] multiple delivery/looking for a second occurence in a…

Top Page
Delete this message
Reply to this message
Author: Gregory Heinrich
Date:  
To: exim-users
Subject: [Exim] multiple delivery/looking for a second occurence in a file
Hello,
I've already sent this message, but I've been told not to send emails that
contain HTML, so I hope you don't mind if I send it again, without HTML, so
that everyone can read it.

I've tried to write a filter that can handle files like this :

mail1@??? : mail2@???,mail3@???

where a email sent from or receveived to mail1@??? is automaticly
sent to mail2@??? and mail3@???
I've tried to modify the script provided in the faqs (see below) but it
doesn't work when I add a second email for copy (due to deliver function
handling only one address at a time).

Another idea would be to handle files like this :

mail1@???: mail2@???
mail1@???: mail3@???

Trouble is I don't know how to look for the second occurence of something in
a lookup/lsearch...

Here is the FAQ entry I find about this topic :

---
Q9817: I need to take copies of all incoming and outgoing mail for certain
users. For each user there may be a different monitoring address.
A9817: You can adapt the filter solution given in Q9810 by adding a test for
the relevant local parts. Create a file containing lines like this:
         user1@domain1:   monitor1@???
         user2@domain2:   monitor2@???


and then use the following command in a system filter:

         if ${lookup{$sender_address}lsearch{/some/file}{$value}{}} is not
""
         then
           unseen deliver
${lookup{$sender_address}lsearch{/some/file}{$value}}
             errors_address = postmaster@???
         else
           if foranyaddress $recipients
             (${lookup{$thisaddress}lsearch{/some/file}{$value}{}} is not
"")
           then
             unseen deliver
${lookup{$thisaddress}lsearch{/some/file}{$value}}
               errors_address = postmaster@???
           endif
         endif
It is messy to have to repeat the lookups, but it won't be inefficient,
because Exim caches the results of successful lookups.
---