I'am searching for a way to bypass some accounts to a diffrent Mailserver then postfix. So some accounts should exist on the postfix server but anything else should be transport to a second SMTP Server. For that I setup a new centos 7 and install postfix with yum install postfix. In the defaultconfig I add transport_maps and for a simple test I add example.com in transport_maps with the destination Mailserver. But in case I send a Mail to [email protected] postfix told me the account doesnet exist.
Postfix only accept Mails for known user so I create a alias in /etc/aliases userX: trash and the Mail will be transport to the destination SMTP Server. My Issue is that I do not know all the aliases from the Destination SMTP Server so I cant add all aliases to aliases.db is there a Option to accept all user on postfix for a known domain?
For a trivial example I need to transport all user to a diffrent SMTP Server.
#postconf -n
alias_database = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, example.com
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 550
And my /etc/postfix/transport looks like:
example.com smtp:smtp.local
UPDATE
As mentioned below I try to solve the issue with fallback_transport
. I had updated my main.cf with
fallback_transport = relay
fallback_transport_maps = hash:/etc/postfix/transport
and the content of /etc/postfix/transport
is
example.com smtp:smtp.local
* smtp:smtp.local
but with this config the issue is the same. The user doestn exist so postfix told me the user doesnt exist. If I delete the example.com URL from mydestination the behavior is that the mail to [email protected] is in the mailq
You have to use either
fallback_transport
orluser_relay
.From: http://www.postfix.org/postconf.5.html
To consider: