Postfix fails to send mail to certain external mail servers:
main postfix/smtp: connect to mx.external.com:25: Connection timed out
main postfix/smtp: BE46D121BD6: to=<firstname.lastname@example.org>, relay=none, delay=150, delays=0.13/0.01/150/0, dsn=4.4.1, status=deferred (connect to mx.external.com:25: Connection timed out)
- outgoing mail mode is set to Send from the specified IP addresses = 203.0.113.2 in Tools and Settings > Mail Server Settings
- Mail is sent successfully when outgoing mail mode is set to Send from domain IP addresses, or when the mail server is switched to Qmail
In Tools and Settings > IP Address there is a private IP 192.0.2.2 assigned to a public IP 203.0.113.2, and a separate IP 203.0.113.2 exists:
In Domains > example.com > DNS Settings all records are assigned to 203.0.113.2 IP except mail.example.com one which is assigned to 192.0.2.2
IPs are configured incorrectly: public IP is assigned on a private IP and it is also added separately, that causes email be sending from 203.0.113.2 while in fact mail.example.com has different IP in it's DNS Settings. Certain mail servers will reject such an email.
Assign IPs correctly:
1. Remove public IP from private IP: Tools and Settings > IP Address > click 192.0.2.2 > remove public IP 203.0.113.2 > click OK. If this step is omitted, it will not be possible to remove 203.0.113.2 on step 2 as it is being used by domain's DNS Settings.
2. Remove 203.0.113.2 from the list: Tools and Settings > IP Address > check 203.0.113.2 checkbox > click Remove.
3. Assign public IP back to the private IP: Tools and Settings > IP Address > click 192.0.2.2 > add public IP 203.0.113.2 > click OK.