Unique question on Postfix rewrite


We’re trying to use postfix as our MTA, and are running into an issue

We want it to set up so emails sent with a from address of user1@. gets re-written to user1@mydomain.com when the email leaves the MTA.

Currently, we can configure Postfix with rewrite rules that have one-one mappings where
user1@something.something.mydomain -> user1@mydomain.com. But we have several subdomains and other internal domains in various combinations that could potentially relay through MTA.
Hence we’re seeking a way to configure it to rewrite the domain name

Any help would be appreciated.

The support gurus in our support venues https://community.ubuntu.com/t/finding-help/712 are awaiting your support question.

Unfortunately, this is not the right place for support. Sorry.