Article 6E6VH Postfix delivers messages locally despite configuration for discovering external agent

Postfix delivers messages locally despite configuration for discovering external agent

by
brainchild
from LinuxQuestions.org on (#6E6VH)
A small node operates several web applications attached to a domain.

The same domain is used for mailboxes, hosted off site by a commercial service.

On the name server operated by the registrar, A, AAAA, and CNAME records are used to resolve the web server, whereas MX records are used to resolve the commercial mail service.

Applications on the web server must deliver mail addressed within the same domain.

Postfix runs on the server, and correctly transfers messages for addresses of other domains based on resolving their MX records. However, messages detected as addressed for a local domain are not transferred to external delivery agents, but rather retained for local delivery, despite that the MX records for the domain give an alternative domain corresponding to the commercial service.

The documentation for Postfix suggests that the desired behavior may be realized by setting a value for the configuration parameter mydestination that excludes as an item in the value list $mydomain.

An answer posted on the StackExchange network gives a similar suggestion, of setting the configuration as follows:

Code:mydestination = $myhostname, localhost.$mydomain, localhostIn fact, such is the actual value currently set, being the default provided by the software stack operating on the host.

Log output is shown below for a message processed by Postfix. The machine host name is substituted with myhostname.myhostplace.tld, and the domain name configured in the mail subsystem is substituted with example.tld, with the mail account used in the message represented as testuser.

Given that the assigned local domain is not included in the criteria for identifying addresses for local delivery of messages, why are messages addressed within the local domain nonetheless still being locally delivered?

Code:postfix/smtpd[11339]: warning: No server certs available. TLS won't be enabled
postfix/smtpd[11339]: connect from localhost[::1]
postfix/smtpd[11339]: F41793F5F: client=localhost[::1], sasl_method=PLAIN, sasl_username=testuser@example.tld
postfix/cleanup[11344]: F41793F5F: message-id=<20230816195532.F41793F5F@myhostname.myhostplace.tld>
postfix/qmgr[10533]: F41793F5F: from=<testuser@example.tld>, size=795, nrcpt=1 (queue active)
postfix/smtpd[11339]: disconnect from localhost[::1] ehlo=1 auth=1 mail=1 rcpt=1 data=1 commands=5
postfix/lmtp[11346]: F41793F5F: to=<testuser@example.tld>, relay=myhostname.myhostplace.tld[private/dovecot-lmtp], delay=0.32, delays=0.28/0.01/0.02/0.01, dsn=2.0.0, status=sent (250 2.0.0 <testuser@example.tld> IKcXErUp3WRTLAAAcQihng Saved)
postfix/qmgr[10533]: F41793F5F: removedCode:postfix/pickup[17489]: 72E744073: uid=0 from=<root@myhostname.myhostplace.tld>
postfix/cleanup[19587]: 72E744073: message-id=<20230816215541.72E744073@myhostname.myhostplace.tld>
postfix/qmgr[10533]: 72E744073: from=<root@myhostname.myhostplace.tld>, size=3595, nrcpt=1 (queue active)
postfix/smtp[19589]: 72E744073: to=<root@localhost>, relay=none, delay=1.3, delays=1.3/0.01/0/0, dsn=5.4.6, status=bounced (mail for localhost loops back to myself)
postfix/cleanup[19587]: AAD6A4165: message-id=<20230816215542.AAD6A4165@myhostname.myhostplace.tld>
postfix/bounce[19590]: 72E744073: sender non-delivery notification: AAD6A4165
postfix/qmgr[10533]: AAD6A4165: from=<>, size=5766, nrcpt=1 (queue active)
postfix/qmgr[10533]: 72E744073: removed
postfix/smtp[19589]: AAD6A4165: to=<root@myhostname.myhostplace.tld>, relay=none, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for myhostname.myhostplace.tld loops back to myself)
postfix/qmgr[10533]: AAD6A4165: removed
postfix/pickup[17489]: 5BF2E4073: uid=0 from=<root@myhostname.myhostplace.tld>
postfix/cleanup[19775]: 5BF2E4073: message-id=<20230816215813.5BF2E4073@myhostname.myhostplace.tld>
postfix/qmgr[10533]: 5BF2E4073: from=<root@myhostname.myhostplace.tld>, size=3696, nrcpt=1 (queue active)
postfix/smtp[19777]: 5BF2E4073: to=<root@localhost>, relay=none, delay=0.77, delays=0.76/0.01/0/0, dsn=5.4.6, status=bounced (mail for localhost loops back to myself)
postfix/cleanup[19775]: A02D04165: message-id=<20230816215813.A02D04165@myhostname.myhostplace.tld>
postfix/bounce[19778]: 5BF2E4073: sender non-delivery notification: A02D04165
postfix/qmgr[10533]: A02D04165: from=<>, size=5867, nrcpt=1 (queue active)
postfix/qmgr[10533]: 5BF2E4073: removed
postfix/smtp[19777]: A02D04165: to=<root@myhostname.myhostplace.tld>, relay=none, delay=0, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail for myhostname.myhostplace.tld loops back to myself)
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments