Create a directory for the virtual domain alias configuration.
mkdir /etc/exim4/virtual
Create an alias file for each virtual domain we want.
/etc/exim4/virtual/example1.net /etc/exim4/virtual/example2.net
The alias files have the following format:
email-part-at-left : destination
Alias content lines examples:
Catch all
address1 : username@localhost
Local user
address1 : username@localhost
Remote email address
address2 : username@domain@xom
Drop all mail
address3 : :blackhole:
Generate a bounce with some text
address3 : :fail: She no longer lives here.
Using single exim4 monolithic configuration file.
vi /etc/exim4/exim4.conf.template
Change:
domainlist local_domains = MAIN_LOCAL_DOMAINS
to
domainlist local_domains = @:otherdomain.xorg:localhost:dsearch;/etc/exim4/virtual
Near line 1155, just after:
##################################################### ### end router/300_exim4-config_real_local #####################################################
Add
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
Using split files exim4 configuration
Edit file /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs
Change the line that start with ‘domainlist local_domains =’ to:
domainlist local_domains = @:otherdomain.xorg:dsearch;/etc/exim4/virtual
Edit file /etc/exim4/conf.d/router/350_exim4-config_vdom_aliases and add the following contents to it:
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
For both configuration types we just need to restart exim
/etc/init.d/exim4 restart
https://debian-administration.org/article/140/Handling_mail_for_multiple_virtual_domains_with_exim4