Hello everyone

I have a setup where my smtp server is reachable through haproxy by means of networking. But the outgoing email uses an exchange server (a relay server to the outside world). So the relay server is only used for sending emails. I do this out of necessity, since the smtp server is internal, on a non-static ip address.

Everything is working well and correctly. The only problem I noticed is that when an email bounces on the relay, it doesn't send the bounced email back to the sender (from the relay to the smtpd server). I'm not sure why this is the case, but I have a guess. This error in the logs:


```

postfix/smtp[301]: 6EA2E9F836DA: to=<u...@example.com>, relay=mail.example.com[1.2.3.4]:25, delay=1.3, delays=0/0/1.3/0, dsn=5.4.6, status=bounced (mail for example.com loops back to myself)

```


Well, as to this message, I understand that example.com matches myhostname, so postfix doesn't know where to deliver that email. Understandable. So after digging into docs, I went ahead and defined `transport_maps` in the settings, with a line `example.com smtp:10.10.100.100` (where 10.10.100.100 is the address where the smtp receiving server can be found), used postmap on it to create the db file, and that seems fine. But then I tried bouncing again, and got the error:


```
postfix/smtp[299]: C0A3C9F906D0: to=<u...@example.com>, relay=10.10.100.100[10.10.100.100]:25, delay=957, delays=950/0.02/6.4/0, dsn=5.4.6, status=bounced (mail for 10.10.100.100 loops back to myself)

```


But... 10.10.100.100 is not the relay server address! It's the address of the smtp server that is supposed to receive the bounced email. Why does it think that this is "back to myself", but writing another server's address?

The complete logs of the incident (in the relay) are as follows:

```
postfix/postfix-script[271]: starting the Postfix mail system
postfix/master[272]: daemon started -- version 3.7.11, configuration /etc/postfix postfix/postscreen[282]: cache btree:/var/lib/postfix/postscreen_cache full cleanup: retained=0 dropped=0 entries postfix/postscreen[282]: CONNECT from [10.10.100.100]:37598 to [10.10.100.1]:61025
postfix/postscreen[282]: WHITELISTED [10.10.100.100]:37598
postfix/postscreen[282]: using backwards-compatible default setting respectful_logging=no for client [10.10.100.100]:37598
postfix/smtpd[284]: connect from unknown[10.10.100.100]
postfix/trivial-rewrite[287]: warning: database /etc/postfix/transport.db is older than source file /etc/postfix/transport
postfix/smtpd[284]: B57629F906CB: client=unknown[10.10.100.100]
postfix/cleanup[288]: B57629F906CB: message-id=<a5e690ab-5dbd-488b-bac0-3c347982f...@example.com> postfix/smtpd[284]: disconnect from unknown[10.10.100.100] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5 postfix/qmgr[274]: B57629F906CB: from=<u...@example.com>, size=10021, nrcpt=1 (queue active) postfix/smtp[289]: B57629F906CB: to=<bouncet...@testtesttesttestytesttesttesttest.com>, relay=none, delay=0.19, delays=0.17/0.02/0.01/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=testtesttesttestytesttesttesttest.com type=AAAA: Host not found) postfix/cleanup[288]: EB0619F906D2: message-id=<20240715131917.eb0619f90...@example.com> postfix/bounce[290]: B57629F906CB: sender non-delivery notification: EB0619F906D2
postfix/qmgr[274]: EB0619F906D2: from=<>, size=12122, nrcpt=1 (queue active)
postfix/qmgr[274]: B57629F906CB: removed
postfix/smtp[289]: warning: host 10.10.100.100[10.10.100.100]:25 greeted me with my own hostname example.com postfix/smtp[289]: warning: host 10.10.100.100[10.10.100.100]:25 replied to HELO/EHLO with my own hostname example.com postfix/smtp[289]: EB0619F906D2: to=<u...@example.com>, relay=10.10.100.100[10.10.100.100]:25, delay=0.47, delays=0/0/0.47/0, dsn=5.4.6, status=bounced (mail for 10.10.100.100 loops back to myself)
postfix/qmgr[274]: EB0619F906D2: removed
```

I would really appreciate some insight into how to properly solve this problem, so that bounced emails are correctly delivered back to the smtp server I point to.

Best regards,
Sam
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to