Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm trying to relay all mail for one domain "ourdomain.tld" from Postfix running on port 2525 of one interface to another SMTP server running on port 25 of another interface on the same machine. However, when a message is received for that domain, we're getting a "mail for loops back to myself" error.

Below are netstat and postconf, the contents of our /etc/postfix/transport file, and the error that Postfix is logging. (The high bytes of each IP address are XXXed out.) Am I missing something obvious? Thanks -

# netstat -ln -A inet
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 XXX.XXX.138.209:25* LISTEN
tcp 0 0 XXX.XXX.138.210:2525* LISTEN

# postconf -d | grep mail_version
mail_version = 2.8.4

# postconf -n
alias_maps = hash:/etc/aliases
allow_mail_to_commands = alias,forward
bounce_queue_lifetime = 0
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
default_privs = nobody
default_process_limit = 200
html_directory = no
inet_interfaces = XXX.XXX.138.210
local_recipient_maps =
local_transport = error:local mail delivery is disabled
mail_owner = postfix
mailbox_size_limit = 0
mailq_path = /usr/bin/mailq
manpage_directory = /usr/local/man
message_size_limit = 10240000
mydestination =
mydomain = ourdomain.tld
myhostname = ourdomain.tld
mynetworks = XXX.XXX.119.0/24, XXX.XXX.138.0/24, XXX.XXX.136.128/25
myorigin = ourdomain.tld
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /etc/postfix
recipient_delimiter = +
relay_domains = ourdomain.tld
relay_recipient_maps =
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
smtpd_authorized_verp_clients = $mynetworks
smtpd_recipient_limit = 10000
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 450

# cat /etc/postfix/transport
ourdomain.tld relay:[XXX.XXX.138.209]:25

# tail -f /var/log/maillog
Aug 2 23:58:36 va4 postfix/smtp[9846]: 9858A758404: to=<nicwolff@...
>, relay=XXX.XXX.138.209[XXX.XXX.138.209]:25, delay=1.1, delays=0.08/0.01/1/0,
dsn=5.4.6, status=bounced (mail for [XXX.XXX.138.209]:25 loops back to myself)
share|improve this question

3 Answers 3

up vote 3 down vote accepted

You can't do that. In your config it says mydomain = ourdomain.tld so you can't relay that domain to "outside" because you told Postfix that it (and only that instance) is responsible for that domain.

Set mydomain = localhost, localhost.localdomain and your problem should be fixed. To make sure, you should also set myhostname = something.ourdomain.tld

share|improve this answer

The problem is in your DNS records. The MX for the domain you're trying to forward will send the mail back to the machine trying to do the forwarding, thus "loops back to myself".

I sort of understand what you're trying to do, but I don't understand why, so I don't have a good suggestion as to what you should do about it.

share|improve this answer
The MX for the domain points to the other interface's IP address, not to the one where Postfix is running. – Nic Wolff Aug 4 '11 at 0:35
Is it possible to show both domains so I can look at it? – bahamat Aug 4 '11 at 2:33

check the the following path

vim /etc/sysconfig/network

if like this.


change only the HOSTNAME to your full qualified domain

reboot the PC and check

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.