Exim Keep a Copy of Sent Email

exim

Anyone know a good way keep a copy of outgoing email that passes through an Exim mail/smtp server? I know incoming mail can be copied and piped to a script, but can outgoing mail also be piped to a script? Any know if it's possible to keep a log of outgoing mail and its contents before mail is sent to its destination?

Best Answer

All that can be done by routers. For example if you want to archive all messages submitted from the local domain, you can create something like that:

archiver:
  driver  = redirect
  senders = <SENDER IS FROM LOCAL DOMAIN>
  domains = <RECIPIENT IS FROM OUTER DOMAIN>
  data    = archive@domain.tld
  pipe_transport  = address_pipe
  unseen

senders and domains conditions should be written to match outgoing messages. Verb unseen guarantee that message should be proceeded in the usual way after copying to the archive.

Related Topic