maddy
maddy copied to clipboard
Add modifiers to rewrite headers
See https://github.com/foxcpp/maddy/issues/158#issuecomment-551166366.
-- Original post:
This should not be used for relays (RFC 5321 prohibits modification of existing header fields) but is usually fine for submission servers. In case of submission, this is what people probably want when saying "replace sender" *. Need to think whether it may be useful for replace_rcpt too.
replace_sender this that {
header on # probably default
}
* replacing only MAIL FROM command argument (as currently done by replace_sender) can invalidate DMARC alignment, btw.
A useful feature implemented in postfix “header_checks REPLACE” allows you to change some fields in the header.
One obscure feature of RFC 5322 is that it permits multiple addresses in the From field. In that case, simple regexp-based replacement may change only one address from the list unless applied repeately. I am not sure whether it is worth supporting (I don't think it is widely supported in clients).
So perhaps as an alternative it might be possible to introduce a set of modifiers for headers manipulation.
add_header KEY VALUE
replace_header KEY VALUE VALUE
replace_header KEY /VALUE/ VALUE
drop_header KEY
I am sure that modifiers are the best option. replace_header FROM [email protected] [email protected]
Blocked by emersion/go-message#75.
Is this still blocked? If not, I'd be willing to try (partially) implementing this, if it's still desired and would be merged
go-message still has a fairly restrictive interface for header manipulation. See discussion of the referenced PR.