Remove Original-Recipient and Final-Recipient fields from MDNs - #8645
Merged
Conversation
link2xt
force-pushed
the
link2xt/remove-mdn-original-recipient
branch
from
September 1, 2026 18:05
5fc0e69 to
35fffe8
Compare
This comment was marked as outdated.
This comment was marked as outdated.
link2xt
marked this pull request as ready for review
September 1, 2026 18:19
link2xt
marked this pull request as draft
September 1, 2026 18:32
link2xt
force-pushed
the
link2xt/remove-mdn-original-recipient
branch
from
September 1, 2026 18:41
7ede343 to
30ccb96
Compare
link2xt
marked this pull request as ready for review
September 1, 2026 18:46
According to <https://datatracker.ietf.org/doc/html/rfc8098#section-3.2.3> Original-Recipient field values in MDNs MUST NOT be included if the information about original recipient is not available. Original recipient may be obtained from ORCPT parameter of SMTP envelope or from Original-Recipient header which MTAs are expected to convert Original-Recipient to. The way we have been using Original-Recipient field is not correct. Technically we should look for Original-Recipient header on the message when downloading it from IMAP and then copy the value into MDN, but simply assuming it is never there is more correct than always assuming it is the same as our current address. I also grepped for Original-Recipient and removed it together with Reporting-UA from the tests. Orignal-Recipient is now only left in NDN (bounce messages) test data, there it is correct as this field is added by MTAs that have direct access to ORCPT parameter.
This Final-Recipient was not set to the correct value anyway. We could query the database and find out via `imap` table which transport we have received the message on, but it is not worth the effort as the field is not practically used and cannot be relied on as old versions still send incorrect value. This removes one call to get_primary_self_addr() to make it easier to remove the concept of the "primary" address eventually.
link2xt
force-pushed
the
link2xt/remove-mdn-original-recipient
branch
from
September 3, 2026 00:40
30ccb96 to
c1258c2
Compare
Hocuri
self-requested a review
September 3, 2026 15:53
Hocuri
approved these changes
Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are two commits, first removes Original-Recipient which was used incorrectly. Second removes Final-Recipient, which is formally required by RFC, but was not set correctly too and is not used anyway.
This is part of #8572, i was looking into why mimefactory still needs to know the "primary" address even with #8619
Commit messages copy-pasted below for convenience:
According to
https://datatracker.ietf.org/doc/html/rfc8098#section-3.2.3 Original-Recipient field values in MDNs MUST NOT be included if the information about original recipient is not available. Original recipient may be obtained from ORCPT parameter of SMTP envelope or from Original-Recipient header which MTAs are expected to convert Original-Recipient to.
The way we have been using Original-Recipient field is not correct. Technically we should look for Original-Recipient header on the message when downloading it from IMAP
and then copy the value into MDN,
but simply assuming it is never there is more correct than always assuming it is the same as our current address.
I also grepped for Original-Recipient
and removed it together with Reporting-UA from the tests. Orignal-Recipient is now only left in NDN (bounce messages) test data, there it is correct as this field is added by MTAs that have direct access to ORCPT parameter.
This Final-Recipient was not set to the correct value anyway.
We could query the database and find out via
imaptablewhich transport we have received the message on,
but it is not worth the effort as the field is not practically used
and cannot be relied on as old versions still send incorrect value.
This removes one call to get_primary_self_addr()
to make it easier to remove the concept of the "primary"
address eventually.