How to add Amazon's X-SES-CONFIGURATION-SET:ConfigSet to a my postfix mail server?

needtoknow asked:

Amazon shows an example on how to add their X-SES-CONFIGURATION-SET:ConfigSet to a single email. How do I add this to my postfix configuration so it uses it for all emails?

My answer:


You can do this with Postfix header_checks (though you will likely want to use the related smtp_header_checks so that it applies only to outgoing mail).

For instance, you can add to main.cf:

smtp_header_checks = pcre:/etc/postfix/ses-configuration-set

Then you create /etc/postfix/ses-configuration-set which contains the header checks:

/^From:/ PREPEND X-SES-CONFIGURATION-SET: ConfigSet

(where ConfigSet is your configuration set name)

(And note that the space is supposed to be there. That the space is missing in Amazon’s example is a minor error.)

Reload postfix and Bob’s your uncle.

This will cause Postfix to prepend the header before the From: header. If your outgoing mails don’t have a From: header, (though they should!) choose a different one that they will contain, such as Subject: or Content-Type:.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.