Adding per-recipient custom headers in a custom hook?
Damian
amavis at arcsin.de
Wed Oct 16 08:01:58 CEST 2024
> Is there a way to do per-recipient header edits in a custom hook?
You would have to split a multi-recipient email into multiple emails before they enter Amavis.
When Amavis handles multiple recipients itself, it tries to keep the number of outbound SMTP transactions as low as possible. In
the best case one inbound email will yield one outbound, even with multiple recipients.
Now if some recipients have different spam score settings, they may have different header-edits, so it will be necessary to split
mails into different transactions. Amavis knows how to handle those cases, but it won't know how to handle custom header-edits.
This is because Amavis calculates transaction batches by means of derived metadata [1], not by means of registered header-edits.
If your custom hook added header-edits in a way does does not respect the transaction batches, you will potentially have wrong
headers for some recipients.
[1] https://gitlab.com/amavis/amavis/-/blob/v2.13.1/lib/Amavis.pm#L4882-4886
More information about the amavis-users
mailing list