Does anyone know of a way to dynamically set the relay host when sending mail through Postfix? At what point does Postfix set the relay host? Is there some way that I can tell Postfix to use a relay host for a particular email (that is outside of global settings)?
Basically, when an email is to be sent to an outbound email address (Gmail, Outlook.com, etc.) I want to be able to choose which relay host to use based on which one has the best deliverability rating. And this could possibly change within seconds so it can't be a "global" postfix setting.
I've thought about creating a content filter which would lookup the "To", find the right relay host and then send the email using another application. However, that seems very awkward to do since we are already in Postfix.
Any help would be greatly appreciated!
Thanks.