Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have set up a HAProxy server which is proxying all emails to my email server. That was done for security purposes.

External IPs:

Proxy server (HAProxy 1.3.26):
Mail server (Exim 4.63):
Both servers are CentOS 5.8.

Here is a part of my HAProxy config:

    mode        tcp
    log         global
    option      dontlognull
    option      httpclose
    option      tcplog
    option      forwardfor
    option      redispatch
listen smtp
    server mail0 maxconn 5000
listen imap
    server mail0 maxconn 5000

Here is the problem:

2012-09-13 22:47:04 1TCERM-0000aP-1A => admin@example.com R=dnslookup T=remote_smtp H=example.com [] X=TLSv1:AES256-SHA:256 DN="/C=XX/ST=XX/L=XX/O=XX/OU=XX/CN=example.com/emailAddress=webmaster@example.com" C="250 OK id=1TCERM-0000aS-IJ"
2012-09-13 22:47:04 1TCERM-0000aP-1A Completed
2012-09-13 22:47:04 1TCERM-0000aS-IJ ** admin@example.com: Too many "Received" headers - suspected mail loop
2012-09-13 22:47:04 1TCERM-0000aU-KD <= <> R=1TCERM-0000aS-IJ U=exim P=local S=9409 from <> for test@example.net
2012-09-13 22:47:04 1TCERM-0000aS-IJ Completed

There are number of such entries in the Exim logs. You see that I am sending from test@example.net to admin@example.com The email is received by the HAProxy server and proxied to the mail server. The problem is the email is gettied looped afterwards. And I can't understand where the problem is.

MX record of my domain example.com is pointed to Mailboxes were created on the server.

Here is a part of the bounced email header (those sections are repeated many times):

Received: from example.com ([] helo=example.com) by dc.example.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1TCDdv-0007PI-Jf for root@dc.example.comt; Thu, 13 Sep 2012 21:55:59 +0400 Received: from example.com ([]) by dc.example.com with smtp (Exim 4.63) (envelope-from ) or root@dc.example.comt; Thu, 13 Sep 2012 21:55:59 +0400 test1

I would be very grateful if someone helps me on this issue. Let me know if you need some details, logs, etc.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

it's because you forget to setup local delivery for domain! in result...

mail sent to domain going over proxy/firewall to destination/local server, and then from destination/local server going back to proxy/firewall server, because exim with this domain using remote mail delivery and checking mx records which pointed to firewall! and that is why you getting loop!

as always sorry for my "russian" :))

share|improve this answer
add comment

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.