Prevent email being sent internally when mailbox does not exist

I’m running in to an issue with the email routing on my server.
Some clients use Google Workspace or Office365 for their email and some use the server/postfix and this causes issues when they sent email to each other from the server.

Because my website is also hosted on this server, this means the clients cannot sent email to me from the server (webmail or php/wordpress) because the server sees the domain and tries an internal delivery. When it notices there is no postfix mailbox, it returns undeliverable.

I noticed that the postfix config uses mysql queries to look for domains. Is there a way to alter these queries to make it look for domains with mailboxes instead? So it only routes to domains with existing mailboxes internally and goes external for the rest?

virtual_alias_maps = proxy:mysql:/etc/postfix/, mysql:/etc/postfix/
virtual_mailbox_domains = proxy:mysql:/etc/postfix/
virtual_mailbox_maps = proxy:mysql:/etc/postfix/

Which one do we need to change for that? virtual_mailbox_domains?

Ok, looks like I found something that works. I changed to not look in the domains table, but in the e_users table to get the domainlist.
It seems to work as I started receiving email on my admin mail again. So, use at your own risk but here’s my /etc/postfix/

user = cyberpanel
password = ***************
dbname = cyberpanel
query = SELECT emailOwner_id AS virtual FROM e_users WHERE emailOwner_id=‘%s’ limit 1;
hosts = localhost