I've got a Postfix setup that allows relays only from certain domains. I accomplish this using the
relay_domains flag in main.cf and it queries mysql to find the list of allowed domains.
relay_domains = mysql:/etc/postfix/mysql_domains.cf
I would like to add a
header_checks instruction to insert a custom header based on the result of the mysql check for
relay_domains which would show which domain was relayed through Postfix. The reason for this is that if the allowed domain is .domain.com and the recipient email address is email@example.com, I'd like to know which .domain.com Postfix resolved to in the lookup.
I've got the header_checks working:
/^From:/i PREPEND X-Relay-Domain: xxx
But I'm not sure how to capture the result of the domain query and use that for the header_checks PREPEND. I could also perform another mysql lookup on
header_checks but I'd like to avoid that if possible.