Can receive mails but when sent loops back to myself

OS type and version Debian 12
Virtualmin version 7.10.0

Hello everyone!

  • domains are just examples*

I recently set up Virtualmin v7.1 on Debian 12 with the hostname abc . def . com. I’m using Cloudflare for DNS management, where I’ve configured def . com, admin . def . com, webmail . def . com, and www . def . com to point to the server’s IP address.

I mostly used default options for the initial configuration. Everything went smoothly when I created the first virtual server, let’s call it domain1 . com. I configured the A record, admin, MX, and everything to point to the server’s IP. However, I encountered a strange issue where accessing def . com or the server IP now loads domain1 . com. All the domains for virtual servers also are configured in Cloudflare.

Additionally, while all virtual servers can receive emails, they are unable to send emails. The mail system on host abc . def . com returns this error mail:

The mail system at host abc . def . com.

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

: mail for [recipient domain] loops back to myself

I’ve hit a wall and haven’t found clear information on how to resolve these issues. Any help would be greatly appreciated!

I’ve hit a wall and haven’t found clear information on how to resolve these issues. Any help would be greatly appreciated! I’m pretty sure this must be a small configuration for fix this but cannot find which is.

There are a lot of ways to end up there, but I think the most common is you named your server the same name as one of your virtually hosted domains in Virtualmin. You shouldn’t do that, it makes no sense to have two things with the same name.

(Other options include changing one of myorigin or mydestination or myhostname and maybe some others in the Postfix. Most people should leave those at their default.)


Appreciate the quick response.

Interestingly, the hostname differed from the hosted domains. After extensive testing, I finally uncovered the issue.

The key insight came when I ran:

host -t mx
The result was: mail is handled by 0 errdomain.

This was certainly not how it functioned before changing my ISP.

Upon inspecting the router settings, I discovered it was using the nameservers from the new ISP via DHCP. I updated these settings, expecting /etc/resolv.conf to reflect the changes. However, there were still issues with Gmail due to PTR configuration, and emails sent to Outlook were landing in the spam folder.

Nevertheless, progress was made :love_you_gesture:, and now I only need to fine-tune the records. Ultimately, the culprit turned out to be the ISP. The Virtualmin was correctly configured hours ago.

Hope this proves beneficial to others encountering similar challenges.

By the way, great application, I will get the PRO version. Is difficult to upgrade from the free version to the PRO?

And… thanks again.

Test your domain at
Upgrading to pro is just a matter of adding the the pro license.
FAQ | Virtualmin — Open Source Web Hosting Control Panel

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.