Why is Postfix trying to connect to other machines SMTP port 25?

Solution 1:

Most likely they are wrong email addresses or your DNS resolution is failing.

Postfix will try to connect to the SMTP server according to the MX record of the ab.xyz.com domain to deliver the email, but if Postfix cannot find a MX record, it will attempt to deliver to the IP of the A record. (That's the expected behavior).

But if the email address domain is wrong (miss-typed, for example) the domain may exist but maybe does not have a MX record and the IP from the A record is a host without a SMTP server.

As an example, some people around here type [email protected] (the correct address is [email protected]), however the hotmail.com.mx domain indeed exists but does not have an MX record, so Postfix tries, and tries, and tries to deliver to an A record host who will never answer at port 25, causing log entries like:

Jul  5 17:03:37 www postfix/smtp[3149]: 6608A108FD2: to=<[email protected]>, relay=none, delay=197971, delays=197971/0.02/0.18/0, dsn=4.4.1, status=deferred (connect to hotmail.com.mx[200.94.181.9]:25: Connection refused)

Solution 2:

Additional things to check for when you are seeing logs like this are,

myhostname and mydestination need to be set correctly in /etc/postfix/main.cf