Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add modifiers to rewrite headers #158

Open
foxcpp opened this issue Nov 6, 2019 · 8 comments
Open

Add modifiers to rewrite headers #158

foxcpp opened this issue Nov 6, 2019 · 8 comments
Labels
blocked Work needs to be done somewhere else before this can be worked on filter Related to message processing middleware ("filters")

Comments

@foxcpp
Copy link
Owner

foxcpp commented Nov 6, 2019

See #158 (comment).

--
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.

@foxcpp foxcpp added the filter Related to message processing middleware ("filters") label Nov 6, 2019
@svanichkin
Copy link

A useful feature implemented in postfix “header_checks REPLACE” allows you to change some fields in the header.

@foxcpp
Copy link
Owner Author

foxcpp commented Nov 7, 2019

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

@svanichkin
Copy link

I am sure that modifiers are the best option. replace_header FROM [email protected] [email protected]

@foxcpp foxcpp added the good first issue Easy to do, good for newcomers. label Nov 11, 2019
@foxcpp foxcpp changed the title Extend replace_sender to allow header rewriting Add modifiers to rewrite headers Nov 11, 2019
@foxcpp
Copy link
Owner Author

foxcpp commented Mar 1, 2020

Blocked by emersion/go-message#75.

@foxcpp foxcpp modified the milestones: 0.4, 0.5 Jul 16, 2020
@foxcpp foxcpp removed the good first issue Easy to do, good for newcomers. label Oct 12, 2020
@foxcpp foxcpp removed this from the 0.5 milestone Jul 10, 2021
@foxcpp foxcpp added the blocked Work needs to be done somewhere else before this can be worked on label Jul 13, 2021
@ptrcnull
Copy link
Contributor

ptrcnull commented Jun 5, 2023

Is this still blocked? If not, I'd be willing to try (partially) implementing this, if it's still desired and would be merged

@foxcpp
Copy link
Owner Author

foxcpp commented Jun 13, 2023

go-message still has a fairly restrictive interface for header manipulation. See discussion of the referenced PR.

@kbakdev
Copy link

kbakdev commented Sep 25, 2024

What's the status of implementing this @ptrcnull ?

@ptrcnull
Copy link
Contributor

i never bothered implementing it in maddy itself, and instead opted for modifying the headers via milter - see example here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Work needs to be done somewhere else before this can be worked on filter Related to message processing middleware ("filters")
Projects
None yet
Development

No branches or pull requests

4 participants