1

What is the best practice when one has to implement this sort of ruleset in postfix?

  • Email sent to a@example.com, b@example.com, etc ought to be relayed to smtp.a.example.com.
  • Email sent to [everyone else]@example.com ought to be relayed to smtp.b.example.com.

Ideally this shouldn't depend on the content of the message - just the RCPT TO SMTP command.

Chris Smith
  • 163
  • 4

1 Answers1

2

Use transport_maps and relayhost feature from postfix. Edit main.cf, and add this two lines

relayhost = smtp.b.example.com
transport_maps = hash:/etc/postfix/transportmaps

The above file (/etc/postfix/transportmaps) should contain something like:

a@example.com  smtp.a.example.com
b@example.com  smtp.a.example.com

Don't forget to postmap that file.

masegaloeh
  • 18,236
  • 10
  • 57
  • 106