fix: remove Original-Recipient field from MDNs

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 commit is contained in:
link2xt
2026-09-01 17:42:58 +00:00
committed by l
parent def14306dd
commit 5ebab3d859
5 changed files with 3 additions and 19 deletions

View File

@@ -2238,11 +2238,10 @@ impl MimeFactory {
// second body part: machine-readable, always REQUIRED by RFC 6522 // second body part: machine-readable, always REQUIRED by RFC 6522
let message_text2 = format!( let message_text2 = format!(
"Original-Recipient: rfc822;{}\r\n\ "Final-Recipient: rfc822;{}\r\n\
Final-Recipient: rfc822;{}\r\n\
Original-Message-ID: <{}>\r\n\ Original-Message-ID: <{}>\r\n\
Disposition: manual-action/MDN-sent-automatically; displayed\r\n", Disposition: manual-action/MDN-sent-automatically; displayed\r\n",
self.from_addr, self.from_addr, rfc724_mid self.from_addr, rfc724_mid
); );
let extension_fields = if additional_msg_ids.is_empty() { let extension_fields = if additional_msg_ids.is_empty() {
@@ -2527,8 +2526,7 @@ fn keyupdate_body(from_addr: &str) -> MimePart<'static> {
message.add_part(MimePart::new( message.add_part(MimePart::new(
"message/disposition-notification", "message/disposition-notification",
format!( format!(
"Original-Recipient: rfc822;{from_addr}\r\n\ "Final-Recipient: rfc822;{from_addr}\r\n\
Final-Recipient: rfc822;{from_addr}\r\n\
Disposition: automatic-action/MDN-sent-automatically; processed\r\n" Disposition: automatic-action/MDN-sent-automatically; processed\r\n"
), ),
)); ));

View File

@@ -269,8 +269,6 @@ async fn test_subject_mdn() {
--SNIPP\r\n\ --SNIPP\r\n\
Content-Type: message/disposition-notification\r\n\ Content-Type: message/disposition-notification\r\n\
\r\n\ \r\n\
Reporting-UA: Delta Chat 1.28.0\r\n\
Original-Recipient: rfc822;bob@example.com\r\n\
Final-Recipient: rfc822;bob@example.com\r\n\ Final-Recipient: rfc822;bob@example.com\r\n\
Original-Message-ID: <2893@example.com>\r\n\ Original-Message-ID: <2893@example.com>\r\n\
Disposition: manual-action/MDN-sent-automatically; displayed\r\n\ Disposition: manual-action/MDN-sent-automatically; displayed\r\n\

View File

@@ -570,8 +570,6 @@ This is no guarantee the content was read.\n\
--kJBbU58X1xeWNHgBtTbMk80M5qnV4N\n\ --kJBbU58X1xeWNHgBtTbMk80M5qnV4N\n\
Content-Type: message/disposition-notification\n\ Content-Type: message/disposition-notification\n\
\n\ \n\
Reporting-UA: Delta Chat 1.0.0-beta.22\n\
Original-Recipient: rfc822;bob@example.org\n\
Final-Recipient: rfc822;bob@example.org\n\ Final-Recipient: rfc822;bob@example.org\n\
Original-Message-ID: <foo@example.org>\n\ Original-Message-ID: <foo@example.org>\n\
Disposition: manual-action/MDN-sent-automatically; displayed\n\ Disposition: manual-action/MDN-sent-automatically; displayed\n\
@@ -626,8 +624,6 @@ This is no guarantee the content was read.\n\
--kJBbU58X1xeWNHgBtTbMk80M5qnV4N\n\ --kJBbU58X1xeWNHgBtTbMk80M5qnV4N\n\
Content-Type: message/disposition-notification\n\ Content-Type: message/disposition-notification\n\
\n\ \n\
Reporting-UA: Delta Chat 1.0.0-beta.22\n\
Original-Recipient: rfc822;bob@example.org\n\
Final-Recipient: rfc822;bob@example.org\n\ Final-Recipient: rfc822;bob@example.org\n\
Original-Message-ID: <bar@example.org>\n\ Original-Message-ID: <bar@example.org>\n\
Disposition: manual-action/MDN-sent-automatically; displayed\n\ Disposition: manual-action/MDN-sent-automatically; displayed\n\
@@ -650,8 +646,6 @@ This is no guarantee the content was read.\n\
--zuOJlsTfZAukyawEPVdIgqWjaM9w2W\n\ --zuOJlsTfZAukyawEPVdIgqWjaM9w2W\n\
Content-Type: message/disposition-notification\n\ Content-Type: message/disposition-notification\n\
\n\ \n\
Reporting-UA: Delta Chat 1.0.0-beta.22\n\
Original-Recipient: rfc822;bob@example.org\n\
Final-Recipient: rfc822;bob@example.org\n\ Final-Recipient: rfc822;bob@example.org\n\
Original-Message-ID: <baz@example.org>\n\ Original-Message-ID: <baz@example.org>\n\
Disposition: manual-action/MDN-sent-automatically; displayed\n\ Disposition: manual-action/MDN-sent-automatically; displayed\n\
@@ -697,8 +691,6 @@ This is no guarantee the content was read.\n\
--kJBbU58X1xeWNHgBtTbMk80M5qnV4N\n\ --kJBbU58X1xeWNHgBtTbMk80M5qnV4N\n\
Content-Type: message/disposition-notification\n\ Content-Type: message/disposition-notification\n\
\n\ \n\
Reporting-UA: Delta Chat 1.0.0-beta.22\n\
Original-Recipient: rfc822;bob@example.org\n\
Final-Recipient: rfc822;bob@example.org\n\ Final-Recipient: rfc822;bob@example.org\n\
Original-Message-ID: <foo@example.org>\n\ Original-Message-ID: <foo@example.org>\n\
Disposition: manual-action/MDN-sent-automatically; displayed\n\ Disposition: manual-action/MDN-sent-automatically; displayed\n\
@@ -1574,7 +1566,6 @@ async fn test_ignore_read_receipt_to_self() -> Result<()> {
--SNIPP\r\n\ --SNIPP\r\n\
Content-Type: message/disposition-notification\r\n\ Content-Type: message/disposition-notification\r\n\
\r\n\ \r\n\
Original-Recipient: rfc822;bob@example.com\r\n\
Final-Recipient: rfc822;bob@example.com\r\n\ Final-Recipient: rfc822;bob@example.com\r\n\
Original-Message-ID: <first@example.com>\r\n\ Original-Message-ID: <first@example.com>\r\n\
Disposition: manual-action/MDN-sent-automatically; displayed\r\n\ Disposition: manual-action/MDN-sent-automatically; displayed\r\n\

View File

@@ -251,8 +251,6 @@ async fn test_mdn_and_alias() -> Result<()> {
--SNIPP\n\ --SNIPP\n\
Content-Type: message/disposition-notification\n\ Content-Type: message/disposition-notification\n\
\n\ \n\
Reporting-UA: Delta Chat 1.28.0\n\
Original-Recipient: rfc822;bob@example.com\n\
Final-Recipient: rfc822;bob@example.com\n\ Final-Recipient: rfc822;bob@example.com\n\
Original-Message-ID: <{msg_id}>\n\ Original-Message-ID: <{msg_id}>\n\
Disposition: manual-action/MDN-sent-automatically; displayed\n\ Disposition: manual-action/MDN-sent-automatically; displayed\n\

View File

@@ -15,7 +15,6 @@ Read receipts do not guarantee sth. was read.
--SNIPP --SNIPP
Content-Type: message/disposition-notification Content-Type: message/disposition-notification
Original-Recipient: rfc822;bob@example.net
Final-Recipient: rfc822;bob@example.net Final-Recipient: rfc822;bob@example.net
Disposition: automatic-action/MDN-sent-automatically; processed Disposition: automatic-action/MDN-sent-automatically; processed