I have a Google Workspace account that has multiple sites running on one user. I have aliases setup for gmail.
I've setup a Google Workspace SMTP Relay to send emails from my linux server for systems like Wordpress using postfix.
It works fine with postfix and emails get sent. However, the problem is that all emails are being mailed by the default domain of the Google Workspace account, because the myorigin setting points to it, e.g default.com.
Here are my postfix/main.cf settings:
myorigin = /etc/mailname
mydestination = localhost
relayhost = [smtp-relay.gmail.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
In the file /etc/mailname, default.com is the entry. If I change it to say domain-2.com then emails will be sent from domain-2.com. But all my sites will also send emails from domain-2.com.
What I want to happen is for every email to be mailed by the appropriate domain. So if domain-3's Wordpress sends an email I want it to be mailed by domain-3.com rather than domain-2.com or whatever is in /etc/mailname
Adding multiple domains to the /etc/mailname file doesn't seem to work.
I also tried
myorigin = localhost
myorigin = localdomain
myorigin = localhost.localdomain
myorigin = local.domain
How can I accomplish this?