I've got several production servers running a LAMP stack. They each have a local Postfix server catching any mail from the system and from PHP, and relaying it via a smarthost (the SendGrid SMTP service).
I'd like to add a custom header to every outgoing message sent to the smarthost. This allows me to filter statistics per server in SendGrid. Something like:
X-SMTPAPI: {"category": "www1"}
The Postfix docs mention using the PREPEND action in a Postfix 'access' table. So, I added the following line to /etc/postfix/access
:
PREPEND X-SMTPAPI: {"category": "www1"}
and hashed the access
file with postmap.
However, I have no idea how to use the map. Something like the following doesn't work:
smtp_client_restrictions = check_client_access hash:/etc/postfix/access
How do I make Postfix prepend this header?