[Exim] copy incoming and outgoind messages to multiple users

Top Page
Delete this message
Reply to this message
Author: Gregory Heinrich
Date:  
To: exim-users
Subject: [Exim] copy incoming and outgoind messages to multiple users
Hi !
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 but it doesn't work when I add a second email for copy (due to deliver function handling only one address at a time).

---
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. 


---