-
-
Notifications
You must be signed in to change notification settings - Fork 22
Sender Based Relay Example
Let's say that we have 4 gmail accounts. [email protected], [email protected], [email protected] and [email protected]
Our relay server is configured with an IP of 169.254.1.12.
We want mail sent by the organization to be sent through our relay to appear as the account specified in the "From:" field of the message. If there is no sender defined, or it doesn't match the other 3 addresses, then send the mail from the [email protected] account.
After a working relay server is configured, the /etc/postfix/main.cf can be modified to add in the following lines.
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
Then, the /etc/postfix/sasl_passwd file can be modified
[email protected] [email protected]:/etc/tokens/[email protected]
[email protected] [email protected]:/etc/tokens/[email protected]
[email protected] [email protected]:/etc/tokens/[email protected]
[smtp.gmail.com]:587 [email protected]:/etc/tokens/[email protected]
Then edit the /etc/postfix/sender_relay
[email protected] [smtp.gmail.com]:587
[email protected] [smtp.gmail.com]:587
[email protected] [smtp.gmail.com]:587
Each of these accounts will need to be set up with oauth2 and have their information placed at /etc/tokens/[address]
or /var/spool/postfix/etc/tokens/[address]
Don't forget to run postmap on the newly created files.
$ cd /etc/postfix
$ sudo postmap sasl_passwd sender_relay