User unknown in virtual alias table

Hello,

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

You should not include domain2.com or domain3.com in mydestination, virtualaliasdomains, or virtualmailboxdomains.

@Vance:

You should not include domain2.com or domain3.com in mydestination, virtualaliasdomains, or 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?

Unfortunately, I am not familiar with Virtualmin. The thing to keep in mind is that your server should not be handling mail locally that is destined for domain2.com or domain3.com - those are taken care of by your external providers. So Postfix should not be told that it is to handle mail for those domains. I'm not sure if disabling "Mail for domain" in Virtualmin is the right way to do that, but there is probably an appropriate setting somewhere.

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).

Vance is correct, for example in cPanel there is an option to tell that a domain's emails are being managed by another provider/server/etc. You should ask the virtualmin/webmin people if there is a similar feature.

Try this: /usr/local/psa/bin/domain -u example.com -mail_service false

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct