Mail bounces with “loops back to myself”
Mail to a domain bounces with loops back to myself when its MX record points to this server but the server does not handle the domain's mail. To fix the Postfix bounce, set up mail for the domain on this server or point its MX record to the host that handles its mail.
Symptoms
Mail to the domain bounces. The mail log at /var/log/maillog on AlmaLinux or /var/log/mail.log on Ubuntu shows this entry.
postfix/smtp[2548]: 789CB10BBF2B: to=<user@example.com>, relay=none, delay=0.02, delays=0.01/0.01/0/0, dsn=5.4.6, status=bounced (mail for example.com loops back to myself)Cause
Postfix sends mail for a domain it does not handle to the domain's MX host. When the MX host is this server, delivery would send the message back to Postfix itself, so it bounces the message.
This happens when the domain's MX record points to this server and the domain either lacks a mail setup on this server or has its mail routing set to remote.
Resolution
Check where the domain's MX record points.
dig +short MX example.comIf this server should handle the domain's mail, add the domain for mail or set its mail routing to
local.urbestack-mail-domain-set --name example.com --routing localIf another host handles the domain's mail, change the MX record at the domain's DNS host to point to that mail host.
Send the message again.