Add to Favourites Add to Favourites    Print this Article Print this Article

I want to log all outbound emails leaving my server

This guide will help you log all emails leaving your server, which have sender domains which are in the /etc/virtual/domains file.
Note that this assumes the "From" address is correct in the message, which isn't always the case.  There may be a better variable to use and check, but this is my best guess at the moment.

1) Edit the file

/etc/system_filter.exim


2) Find the code:

if not first_delivery
then
     finish
endif


3) Right after the code from #2, add this code

if "${lookup{$sender_address_domain}lsearch{/etc/virtual/domains}{true}{false}}" is "true"
then
            unseen deliver "email@notification.com"
endif

Where you'd replace email@notification.com with the email value you want all outbound emails to be saved to.

4) Save/exit and restart exim:

/etc/init.d/exim restart



Was this answer helpful?

Also Read