Hello,
this is not how the mailserver app for UCS (or any mail server for that matter) is intended to be used. It is intended to serve your own domain(s) only.
If you create a maildomain “google.com”, you won’t be able to send emails to any other google-user anymore. The UCS-server will be the one responsible for that domain now and will store the mails locally (for your UCS users) or reject them if the address is unknown (all other gmail users).
You have to create your own domain name as a mail-domain on UCS and then use fetchmail to retrieve the mails from the other mail providers (gmail, yahoo, …). Depending on your company policy you can either create per-user SMTP-relay rules to send emails away or have your users configure their clients to send mails directly via gmail, but store the sent mail on the UCS IMAP server.
Greetings
Daniel Tröder