Forwarding virtual user’s email with exim’s filter

exim

I'm using file-based configuration (no dbm, nor sql) for my few virtual domains/users with exim/dovecot.

My configure contains next routers:

virtual_filter:
  driver = redirect
  allow_filter
  no_check_local_user
  condition = ${if exists{/home/mail/${domain}/${local_part}/filter}{yes}{no}}
  domains = dsearch;/etc/mail/virtual
  router_home_directory = /home/mail/${domain}/${local_part}
  user = mailnull
  group = mail
  file = /home/mail/${domain}/${local_part}/filter
  file_transport = virtual_address_file
  pipe_transport = address_pipe
  retry_use_local_part
  no_verify

virtual_user:
     ....

virtual_aliases:
     ....
     no_more

so, if exists /home/mail/virtualdomain.com/username/filter the exim will use it.

One of my users asking to copy his all incoming emails to his gmail account too. Because

  • my config doesn't have .forward checks for virtual users
  • and the aliases for virtual domains are checked only after the virtual_user delivery route, so only if the given address has not virtual mailbox
  • but the above virtual_filter is the first rule in the routers

looking for a way how to copy all incoming email for this one user using his filter.

I tried the

unseen deliver <username@gmail.com>

but this caused only fowrard to all emails to gmail without the delivery to dovecot, and i want the both: 1.) via the virtual_user route deliver as standard, and 2.) send a copy of the message to username@example.com

Any suggestion?

Best Answer

Just figured out, it is enough add to:

/home/mail/myvirtualdomain.com/myuser/filter

the next two lines

unseen noerror deliver <username@gmail.com>
deliver <myuser@myvirtualdomain.com>

so, deliver one copy to gmail and another one to normal mailbox.

Related Topic