Sendry supports header manipulation rules to modify email headers before sending. This is useful for:
- Removing headers that expose internal infrastructure
- Adding custom tracking or compliance headers
- Standardizing headers across all outgoing mail
Header rules are configured in the header_rules section of the config file. No additional setup is required.
header_rules:
# Global rules (applied to all domains)
global:
- action: remove
headers:
- "X-Originating-IP"
- "X-Mailer"
- "User-Agent"
- action: add
header: "X-Processed-By"
value: "Sendry"
# Per-domain rules
domains:
example.com:
- action: replace
header: "X-Mailer"
value: "Example Mail Server"Removes specified headers from the email.
- action: remove
headers:
- "X-Originating-IP"
- "X-Mailer"
- "User-Agent"Header names are case-insensitive. All occurrences of the specified headers are removed.
Replaces the value of a header. If the header doesn't exist, it's added.
- action: replace
header: "X-Mailer"
value: "MyMailServer/1.0"Only the first occurrence is replaced if multiple headers with the same name exist.
Adds a new header. Always appends, even if the header already exists.
- action: add
header: "X-Processed-By"
value: "Sendry"- Global rules are applied first
- Domain-specific rules are applied after global rules
- Rules are applied in the order they appear in the config
Remove headers that reveal internal infrastructure:
header_rules:
global:
- action: remove
headers:
- "X-Originating-IP"
- "X-Mailer"
- "User-Agent"
- "X-MimeOLE"Add required compliance or tracking headers:
header_rules:
global:
- action: add
header: "X-Organization"
value: "Example Corp"
- action: add
header: "X-Compliance-ID"
value: "GDPR-2024"Different headers for different sending domains:
header_rules:
domains:
marketing.example.com:
- action: add
header: "X-Campaign-Source"
value: "marketing"
support.example.com:
- action: add
header: "X-Department"
value: "support"Replace auto-generated headers with custom values:
header_rules:
global:
- action: replace
header: "X-Mailer"
value: "Sendry MTA"- Header matching is case-insensitive (
X-Mailermatchesx-mailer,X-MAILER) - Multiline headers (with continuation) are handled correctly
- Rules do not affect the message body
- DKIM signing happens after header rules are applied