linuxeximexim4

How to save and redirect mail with exim 4


I have working redirecting configuration for exim4 on my server with the help of tutorial. It works with virtual hosts, I followed the following tutorial - the last part

vdom_aliases:
  driver = redirect
  allow_defer
  allow_fail
  domains = dsearch;/etc/exim4/virtual
  data = ${expand:${lookup{$local_part}lsearch*@{/etc/exim4/virtual/$domain}}}
  retry_use_local_part
  pipe_transport   = address_pipe
  file_transport   = address_file
  no_more

What I need is to not only redirect the mails to the ones specified but also save them first locally.

Is there a way to do it? Thanks.


Solution

  • You have to use verb unseen in the routers. Usually first matched router process message and then routing is complete. But when matching router have unseen processing continues like message wasn't been matched before.

    vdom_aliases: # redirect message
      driver = redirect
      domains = dsearch;/etc/exim4/virtual
      data = ${expand:${lookup{$local_part}lsearch*@{/etc/exim4/virtual/$domain}}}
      unseen      # keep routing
    
    localdeliver: # do everything else
      driver = accept
    . . . . . . . .