So I have used Virtualmin for years hosting several of my websites.
Lately we need a better email and calendar solution than what IMAP can provide, so have chosen to use MS Office 365 for my main company website email service provider (mainwebsite.com).
For the first website (mainwebsite.com) I have the Mail feature disabled (in edit virtual server).
The second website (anotherwebsite.com) Mail is enabled and I use this to forward from this to my first email address (my.name@mainwebsite.com).
I do not have any users setup on mainwebsite.com as there is no email hosted on this server, hence the message from the mail.log as above.
I can see whats happening I think, where the domain part is matching the virtualhost and is trying to be delivered locally on the server, but it needs to be sent out to the internet where it will see the mx record (on cloudflare.dom) and be delivered to my Office 365 account.
I hope you can follow this and there is a solution to push the email out from my server to the internet for the NS/DNS lookup.
In your Virtualmin DNS, edit the records for mainwebsite to reflect the actual DNS records, particularly the MX records for the domain. There is currently a disparity between the Virtualmin DNS records and the actual DNS records for mainwebsite due to which Virtualmin / Postfix is attempting to deliver email for my.name@mainwebsite to localhost instead of Office 365 servers, as you have correctly surmised, @wozie
When I send to this email: sales@anotherwebsite.com it still shows a bounce in the log with the same error:
Nov 27 11:26:19 hostname postfix/local[152530]: 790CA8094F: to=my.name@mainwebsite.com, orig_to=sales@anotherwebsite.com, relay=local, delay=0.03, delays=0.01/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: “my.name”)
Seems still to look on this server for the user on this domain and not looking out. Did I set the TTL too high?
Apologies, I did restart Bind9: “systemctl restart bind9” forgot to add it to the last post.
FYI: I copied the DNS settings for the MX record from my working existing settings on cloudflare to the server as above. However the Priority on Cloudflare is 1 and on my server is Priority 0.
I can confirm I am still seeing the bounce in the mail.log.
Yeah, your solution made sense to me to tell it to look elsewhere for the user with the addition of the MX record. Strange it is still looking on the server for the “my.name” user.
Ah, I had assumed (and it is Virtualmin’s recommendation) that hostname be a subdomain such as vps.mainwebsite.com and if it is not then, of course, merely adding a MX will not do the trick in your case.