I'm sending email via the Gmail API, in Python, as per https://developers.google.com/gmail/api/v1/reference/users/messages/send#examples
I have a domain alias and inboxes setup with catch-all addresses, so emails to anything@sub.example.com and anything@alias.example.com both end up in the inbox for tech@sub.example.com.
Both tech@sub.example.com and tech@alias.example.com are set as "accounts I own" in the Gmail settings, and I did not have to verify ownership of the second account when I added it (presumably because its domain is an alias).
Using the API I'm processing received emails and then re-sending them from the account they were sent to, setting the "from" header in the MIMEMessage. Unfortunately they're always received as sent from the email address owning the mailbox.
Other questions (e.g. [1], [2]) suggest this should "just work", at least via SMTP, which I've also tried. I think it must be a quirk of using a domain alias.
[1] Changing the `from` address when sending an email through GMail
[2] How to set From Address to any email other gmail in ( Sending Email in .NET Through Gmail )?