Forward loop bounces

I’m trying to migrate a few domains out of cPanel in Virtualmin, with success mostly, but for an annoying forward loop mail problem that is generating bounces.

I would send a mail to:


And Postfix would try to relay it locally to:


thus creating a forward loop and then a bounce message.

Is it because the host and the test domain set up to… test the migration are both on the same domain.tld? Or is it some configuration detail I messed up (most probably)?

Thanks for you help.


Can you post the exact bounce message you’re receiving?

What you’re describing above sounds normal, in that when attempting to deliver a message, it delivers to username@hostname.tld – it sounds like your system attempted that, but it didn’t work for some reason.

Also, if you look in Edit Virtual Server -> Enabled Features for the domain that isn’t working, is the “Mail for Domain” feature enabled?



Here it is:

This is the mail system at host host.domain.tld.

I’m sorry to have to inform you that your message could not
be delivered to one or more recipients. It’s attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

               The mail system

test-test.domain.tld@host.domain.tld (expanded from
test@test.domain.tld): mail forwarding loop for

Final-Recipient: rfc822; test-test.domain.tld@host.domain.tld
Original-Recipient: rfc822;test@test.domain.tld
Action: failed
Status: 5.4.6
Diagnostic-Code: X-Postfix; mail forwarding loop for

Thank you much.

Seems like the Virtualmin migration script writes an entry in /etc/aliases for every imported mailbox:

test-test.domain.tld: <strong>test@domain.tld,someaddress@someotherdomain.tld

This is the loop origin. No idea why the script writes an entry in /etc/aliases with the target email, hence creating a loop. Bug? Clumsy configuration by me of the server template used while migrating the virtual servers?

Solution: delete all looping emails in /etc/aliases:

test-test.domain.tld: someaddress@someotherdomain.tld

then call:

postalias /etc/aliases

Please read in “(Somewhat) solved” above:

test-test.domain.tld: \test@test.domain.tld,someaddress@someotherdomain.tld