Hello everyone, I have been running postfix for two mail domains (say,
domain1.net and domain2.net) for a while and everything works fine.
However, in my main.cf configuration file I have set myhostname =
mail.domain1.net and thus, every mail received from my postfix SMTP
contains a header line of the form:
Received: from mail.domain1.net (.... [xxx.xxx.xxx.xxx]) by ...
This annoys me as I prefer not to mix domain1 and domain2. I thus
decided to set up two new transports in master.cf and use
sender_dependent_relayhost_maps.
I add the two following lines to master.cf:
domain1 unix - - n - - smtp
-o smtp_helo_name=mail.domain1.net
domain2 unix - - n - - smtp
-o smtp_helo_name=mail.domain2.net
and the following line to main.cf:
sender_dependent_relayhost_maps = regexp:/etc/postfix/relay_reg
Then relay_reg contains:
/@domain1\.net$/ domain1:
/@domain2\.net$/ domain2:
From what I read everywhere, this should work after a run of postmap
relay_reg and postfix reload but it does not...
When I try sending an email I then get an error mail back with the message:
<...>: Host or domain name not found. Name service error for
name=domain1 type=A: Host not found
It seems that instead of using the transport defined in master.cf,
postfix tries to relay the mail to a host called domain1... I have no
idea why so any help is welcome!
I run postfix 2.6.5 on a gentoo server, here is what postconf -n returns:
alias_maps = mysql:/etc/postfix/mysql-aliases.cf
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = //usr/lib/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
default_destination_concurrency_limit = 10
home_mailbox = maildir/
html_directory = /usr/share/doc/postfix-2.6.5/html
local_destination_concurrency_limit = 2
local_recipient_maps = $alias_maps $virtual_mailbox_maps unix:passwd.byname
local_transport = local
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost
myhostname = mail.domain1.net
mynetworks = 127.0.0.0/8,xxx.xxx.xxx.xxx (the IP of my server)
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases
non_smtpd_milters = unix:/var/run/dkim-filter/dkim-filter.sock
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.5/readme
relocated_maps = mysql:/etc/postfix/mysql-relocated.cf
sample_directory = /etc/postfix
sender_dependent_relayhost_maps = regexp:/etc/postfix/relay_reg
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtp_tls_note_starttls_offer = yes
smtp_use_tls = yes
smtpd_milters = unix:/var/run/dkim-filter/dkim-filter.sock
smtpd_recipient_restrictions =
permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_security_options = noanonymous
smtpd_tls_CAfile = /etc/postfix/cacert.pem
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/postfix/newcert.pem
smtpd_tls_key_file = /etc/postfix/newkey.pem
smtpd_tls_loglevel = 0
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual-gid.cf
virtual_mailbox_base = /
virtual_mailbox_domains = domain1.net, domain2.net
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-maps.cf
virtual_minimum_uid = 1000
virtual_transport = virtual
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual-uid.cf