User unknown in virtual alias table
I need some help to fix a problem on sending emails from the VPS.
Introduction:
My server has Virtualmin, Usermin and Webmin installed.
It's hosting a few different domains, including my main one.
All DNS settings are managed in Cloudflare.
Some domains are using Google G Suite or Zoho for email management.
Scenario:
domain1.com -> emails are managed in Virtualmin/Webmin
domain2.com -> emails are managed in Google G Suite
domain3.com -> emails are managed in Zoho
Sending email from external provider (e.g: Gmail) to domain2.com or domain3.com -> WORKS
Sending email from VPS (command line or php) to any domain -> DOESN'T WORK
Every time I try to send an email to any domain which is hosted in my server but emails are managed by external providers (such as Google or Zoho), I'm getting an error from postfix that says "User unknown in virtual alias table). Yes, usually those recipient address are not listed in the virtual alias tables, once those are managed by Google or Zoho. So, my postfix isn't being able to dispatch the messages correctly.
So, here's where I need help!
How can I make postfix to either also check external DNS settings, or ignore the virtual alias table before bounce a message sent from VPS, using command line or php scripts?
5 Replies
mydestinationvirtualaliasdomainsvirtualmailboxdomains
@Vance:
You should not include domain2.com or domain3.com in
, mydestination, or virtualaliasdomains. virtualmailboxdomains
Hi Vance,
Thank you for your help.
My server pretty much only has 'virtualaliasmaps = hash:/etc/postfix/virtual' set in '/etc/postfix/main.cf'. Checking the file '/etc/postfix/virtual', yes, pretty much all domains created with Webmin are included in that file, unless 'Mail for domain' feature is disabled for such domain. Always I create a new domain, boom, it is included automatically by Virtualmin.
I've made a test and removed from one of that domains the 'Mail for domain' feature, from Virtualmin control panel. Then, for that domain, it has started working again. It seems that whenever Virtualmin has that feature enable, postfix seems to not check external relays if user doesn't be found in the virtual alias table.
Any clue on how could I fix it without run over all domains removing the feature?
The main thing you need to worry about is setting up the correct DNS for domain2.com and domain3.com - since it sounds like e-mail originating from outside your Linode works, that's probably OK.
If a message originates on your Linode with a destination address @domain2.com or @domain3.com, Postfix will do those same DNS lookups and direct the mail toward your external provider (as long as it hasn't been told those domains are local).