Why does Postfix deliver mails locally instead of relaying them?

We get the following error message if the OP5 host tries to deliver emails:

Oct 23 02:23:44 thuop5 postfix/qmgr[2690]: 8F98A1020C3: from=<monitor@xyz.ch>, size=1041, nrcpt=1 (queue active)</monitor@xyz.ch>
Oct 23 02:23:44 thuop5 postfix/pickup[5959]: 91C511020BE: uid=299 from=
Oct 23 02:23:44 thuop5 postfix/cleanup[4762]: 91C511020BE: message-id=<20171023002344.91C511020BE@xy.ch>
Oct 23 02:23:44 thuop5 postfix/local[4764]: 8F98A1020C3: to=<user.1@xy.ch>, relay=local, delay=0.03, delays=0.02/0/0/0.01, dsn=5.1.1, status=bounced (unknown user: "user.1")</user.1@xy.ch>

Answer: Postfix evaluates the local hostname from $myhostname variable. This variable holds the FQDN of the server, so the postfix believes he should deliver emails locally. Change the variable in /etc/postfix/main.cf. Restart the mail service by using service postfix restart.

mydestination = localhost.$mydomain, localhost
#mydestination = $myhostname, localhost.$mydomain, localhost

After the suggested change, email messages should be delivered via smtp-relay:

Oct 23 10:28:38 thuop5 postfix/qmgr[32155]: 3CFE2100287: from=<monitor@xy.ch>, size=335, nrcpt=1 (queue active)</monitor@xy.ch>
Oct 23 10:28:38 thuop5 postfix/smtp[1600]: 3CFE2100287: to=<user.1@xy.ch>, relay=smtp.xy.ch[]:25, delay=0.17, delays=0.01/0/0.01/0.14, dsn=2.6.0, status=sent (250 2.6.0 <20171023082838.3CFE2100287@xy.ch> [InternalId=29356101468970, Hostname=sc005568.xy.ch] 1659 bytes in 0.131, 12,316 KB/sec Queued mail for delivery)</user.1@xy.ch>
Oct 23 10:28:38 thuop5 postfix/qmgr[32155]: 3CFE2100287: removed

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.