I have a few requirements which seem to be opposed to each other, as what I'm currently doing is causing a mail loop and bounce. Here's what I'm trying to accomplish: 1) This server is a standalone server sending outgoing mail, it is not receiving anything other than locally posted messages 2) Messages need to come from "mydomain.com" (myorigin = $mydomain) 3) Messages sent to local 'root' account must be forwarded to a different account @mydomain.com 4) Delivery to all but a few domains is not allowed, and must be discarded
For #2 I'm using the already mentioned myorigin = $mydomain. This works as expected, but $mydomain is not listed in mydestination, so for #3 I am using the method mentioned here: http://www.postfix.org/STANDARD_CONFIGURATION_README.html#some_local (virtual_alias_maps) to deliver the root mail locally, and allowing the rest to go off to our main mail server. For #4, I am using transport_maps (which was suggested in this thread http://archives.neohapsis.com/archives/postfix/2008-07/0875.html), and my transport file contains the following: mydomain.com smtp *.mydomain.com smtp * discard The problem I am seeing is that when I send a message to root using the local command "mail root", the domain gets added (as expected), then the virtual alias changes the to address to r...@localhost.mydomain.com, but then it is bounced because of looping. I've reached the edge of my current postfix knowledge, and would appreciate any input or suggestions. Relevant information: Server is running CentOS 5.2 Linux ---- rpm -q postfix: postfix-2.3.3-2.1.el5_2 ----- postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix debug_peer_level = 2 html_directory = no inet_interfaces = localhost mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost myorigin = $mydomain newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES sample_directory = /usr/share/doc/postfix-2.3.3/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop transport_maps = hash:/etc/postfix/transport unknown_local_recipient_reject_code = 550 virtual_alias_maps = hash:/etc/postfix/virtual ---- /etc/aliases root: ad...@mydomain.com ---- /etc/postfix/transport: mydomain.com smtp *.mydomain.com smtp * discard ---- /etc/postfix/virtual: root r...@localhost ---- maillog: postfix/pickup[5241]: AAB102019B: uid=0 from=<root> postfix/pickup[5241]: AAB102019B: uid=0 from=<root> postfix/cleanup[5248]: AAB102019B: message-id=<20090211213405.aab1020...@server.mydomain.com> postfix/cleanup[5248]: AAB102019B: message-id=<20090211213405.aab1020...@server.mydomain.com> postfix/qmgr[5242]: AAB102019B: from=<r...@mydomain.com>, size=307, nrcpt=1 (queue active) postfix/qmgr[5242]: AAB102019B: from=<r...@mydomain.com>, size=307, nrcpt=1 (queue active) postfix/smtp[5250]: AAB102019B: to=<r...@localhost.mydomain.com>, orig_to=<root>, relay=none, delay=0.09, delays=0.01/0/0.07/0, dsn=5.4.6, status=bounced (mail for localhost.mydomain.com loops back to myself) postfix/cleanup[5248]: BF9BF2019C: message-id=<20090211213405.bf9bf20...@server.mydomain.com> postfix/bounce[5251]: AAB102019B: sender non-delivery notification: BF9BF2019C postfix/qmgr[5242]: BF9BF2019C: from=<>, size=2174, nrcpt=1 (queue active) postfix/qmgr[5242]: AAB102019B: removed postfix/smtp[5250]: AAB102019B: to=<r...@localhost.mydomain.com>, orig_to=<root>, relay=none, delay=0.09, delays=0.01/0/0.07/0, dsn=5.4.6, status=bounced (mail for localhost.mydomain.com loops back to myself) postfix/cleanup[5248]: BF9BF2019C: message-id=<20090211213405.bf9bf20...@server.mydomain.com> postfix/bounce[5251]: AAB102019B: sender non-delivery notification: BF9BF2019C postfix/qmgr[5242]: BF9BF2019C: from=<>, size=2174, nrcpt=1 (queue active) postfix/qmgr[5242]: AAB102019B: removed postfix/smtp[5250]: BF9BF2019C: to=<r...@localhost.mydomain.com>, orig_to=<r...@mydomain.com>, relay=none, delay=0, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for localhost.mydomain.com loops back to myself) postfix/qmgr[5242]: BF9BF2019C: removed postfix/smtp[5250]: BF9BF2019C: to=<r...@localhost.mydomain.com>, orig_to=<r...@mydomain.com>, relay=none, delay=0, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for localhost.mydomain.com loops back to myself) postfix/qmgr[5242]: BF9BF2019C: removed PS. Please forgive that I have changed the server name and domain.