Input data
I have one domain example.com and two mail servers that maintain that maintain this domain: 1 - gmail workspace post app, 2 - self hosted postfix instance (via mailu).
MX record for my domain example.com is smtp.google.com, so all mail first of all goes to gmail smtp servers and deliver to google workspace (GW) users. In GW gmail i made a route rule: all mail for users that dont exist at GW redirects to postfix SMTP server smtp.example.com.
So, users in GW and mailu are individual and and don't repeat. For example:
GW users:
user1
user2
Mailu postfix users:
user3
user4
Finally this scheme works correct for all incoming mail for my domain. GW check if users exist in workspace, and send it locally (if exist) or send to postfix (if not).
Problem
Postfix think he is maintain all domain example.com. When user from postfix (user3) sends email to another postfix user (user4), it checks if user exist locally and send email to user4 inside instance (without the Internet). And it's OK for me. BUT when user3 try to send mail to user1 or user2 postfix get an error Recipient address rejected: User unknown in virtual mailbox table and cant deliver it.
It makes sending of mail from postfix to gmail unreal.
What I tried to do
First of all tried to disable postfix local user searching and to unlock possibility send mail from postfix to my domain. I made it by route all users at example.com to go to google's smtp.
virtual_mailbox_domains = lmdb:/etc/postfix/virtual-mailbox-users
vi /etc/postfix/virtual-mailbox-users
@example.com smtp.google.com
It works but partly only: postfix send mail to gmail, gmail check this user's existence. If its exist (user1 for example) it send in directly to [email protected] in gmail. If not (user3 for example), according to route rule gmail send it to postfix's smtp. Postfix check existence of user3 and makes repeated smtp request and sent it to google's smtp server (according to MX record). Result of all of this is loop and finally mail is rejected in reason of big number of hops. This approach makes unavailable deliver mail for postfix users (from external and internal senders).
I tried to use transport_maps, virtual_mailbox_maps sender_dependent_relayhost_maps, relay_domains and another native postfix parameters and combination of it but without success.
In conclusion
Must say I searched a ton of forums and docs, but cant find workable solution.
The main question for me is: is it possible at all? Postfix has so much setting and really none of then can resolve my request? If anyone has en experience in same setup or know how to solve it please let me know :)