Please use example.com instead of domain2.com, example.com (and .org .net) was specifically created for examples and documentation.
In your /etc/exim4/update-exim4.conf.conf you have configured:
dc_use_split_config='false'
However you are changing something in /etc/exim4/conf.d/router/999_exim4-config_redirect which will be ignored because you are not using split configuration.
Either do:
dc_use_split_config='true'
And reload exim4, you may prefer to change it using:
dpkg-reconfigure exim4-config
Or edit /etc/exim4/exim4.conf.template to add your customisations instead and reload exim4 once done.
Debian exim4 has a feature called hubbed_hosts which can be a convenient way to accomplish what you want without having to add your own routers et al.
So if your want your server to send email destined for domain example.org to domain example.com which has MTAs listening on IPs 192.0.2.1 and 192.0.2.10 you do the following:
Note, no spaces between the IP addresses and they're separated by a colon ':'
What this does is it will relay email destined for example.org to IPs 192.0.2.1,192.0.2.10 (in my example the IPs of example.com). It therefore will ignore the MX records of that domain. The IP address could be anything, as long as it is configured to receive those emails.
Finally there is address rewriting, see: http://www.exim.org/exim-html-current/doc/html/spec_html/ch31.html
Perhaps it has something that will fit your requirements. You could use it in addition to hubbed_hosts.
figured it out. I was missing some entries in my main.cf file:
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, reject
virtual_alias_maps = hash:/etc/postfix/virtual
local_recipient_maps =
making the full main.cf:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_reject_unlisted_recipient = no
smtpd_recipient_restrictions = permit_mynetworks, permit_auth_destination, reject
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = server1.helpmeco.de
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = helpmeco.de, server1.helpmeco.de, localhost.helpmeco.de, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_command =
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = Maildir/
virtual_alias_maps = hash:/etc/postfix/virtual
local_recipient_maps =
Best Answer
You can use PCRE In /etc/postfix/main.cf:
/etc/postfix/headers_check:
PCRE works with perl regular extentions, and you can specify any conditions.