Error in sending emails from subdomain to domain

Operating system: Ubuntu Linux 20.04.2
Wemin: 1.973
Virtualmin: 6.15

I have hosted main domain (domain dot com) and subdomain (sub dot domain dot com) on the above machine as separate virtual servers.

The machine hostname = domain dot com

For email on domain dot com I use Google workspace.

Whereas, email for sub dot domain dot com are set up on the virtualmin. All SPF, DMARC, DKIM and MX records from Virtualmin are correctly configured on the DNS zone (at the domain dot com registrar’s). The email config are tested and I get 10/10 on mail-tester.

Using email from user at sub dot domain dot com, I can –

  • Send and receive emails to/from other domains (e.g. gmail, yahoo)

  • Receive emails from domain dot com

  • But, CAN NOT send emails to domain dot com. I get the below error message.

Failed to send mail : SMTP command rcpt to: user@domain.com failed : 550 5.1.1 user@domain.com: Recipient address rejected: User unknown in local recipient table

Would anyone be able to give me some pointers?

Many thanks in advance.

Change the MX records on Virtualmin’s DNS for domain dot com to reflect the actual MX of the domain.

1 Like

Thanks calport for your reply.
I have already done that.
Virtualmin DNS of domain dot com has 2 MX records pointing to Google (1 ASPMX.L.GOOGLE.COM. and 5 ALT2.ASPMX.L.GOOGLE.COM).

Virtualmin DNS of the sub dot domain dot com’s MX record (5 mail dot sub dot domain dot com) is placed on domain registrar’s DNS.

I also tried various options (currently empty) in Webmin > Servers > Postfix Mail Server > General Options > What domains to receive mail for.

I guess, domain dot com uses Google’s servers as MX record, but has email routing set to “local”, server tries to deliver mails locally. But as there are no mailboxes within the server, it ends up in the error “User unknown in local recipient table”.

On the server sub dot domain dot com, when domain dot com is added to ‘mydestination’ setting, mail server tries to deliver mails for user at domain dot com within the server. And when there is no exact mail address created on the server, mail bounces with error “User unknown in local recipient table”.

Not sure if this is the right direction!
Thanks in advance.

host name should be always something.domain.com

that something could be like host.domain.com or server.domain.com or computer.domain.com. It should not be just domain.com that would cause the issues.

Edit: or name it as machine.domain.com and use domain.com as you would normally host with virtualmin.

2 Likes

Thanks. I tried the followings:

  • Changed the hostname to xxxxx.provider dot net (no domain reference) > Postfix Mail Server > General Options > What domains to receive mail for > tried all three seperately - Local machine, Whole domain, ‘$myhostname, localhost.provider dot net, localhost’ > Reboot (first time, then just Postfix Stop-Start).

I get slightly different error in all three options:
Failed to send mail : SMTP command rcpt to: user@domain.com failed : 550 5.1.1 user@domain.com: Recipient address rejected: User unknown in virtual alias (instead of local recipient) table.

Do you by any chance have the mail feature enabled under the domain features?
Or is the system hostname the same as the domain in question?

That’s Brilliant!
I changed the hostname, but forgot to disable email in domain dot com. I disabled it and now I CAN send, receive emails to/from user@sub.domain.com to user@domain.com.
Thank you ALL for the tips.

1 Like

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