create a directory virtual in the /etc/exim4 open the virtual directory and create a file for each virtual domain with domain names:
touch example.com
touch example.net
Add the users for each domain in their file:
khalid : khalid@localhost
ahmad : hameed@localhost
* : khalid@localhost
The mails coming for the user khalid will go to the khalid mail box (khalid@localhost), the mails coming for the user ahmad will go
to the other user hameed mail box (hameed@localhost), the last line is a catch all mail, will go to the user khalid mail box.
#####################################################
### router/350_exim4-config_vdom_aliases
#####################################################
vdom_aliases:
debug_print = "R: vdom_aliases for $local_part@$domain"
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
vdom_aliases_suffix:
debug_print = "R: vdom_aliases_suffix for $local_part@$domain"
driver = redirect
local_part_suffix = +*
local_part_suffix_optional
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
#####################################################
### end router/350_exim4-config_vdom_aliases
#####################################################
Restart the exim4.
telnet localhost 25
telnet example.com 25
If want to add the other smtp port for exim4 to listen like 2525 , open the /etc/default/exim4
and add as:
# options for daemon listening on port 25 and port 2525
SMTPLISTENEROPTIONS='-oX 2525:25'
25, 2525, 8025, 587 and 465 for ssl
exim4 -d -bt user_name@your_domain.com