mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
prefer X-Microsoft-Original-Message-ID, if set
outlooks SMTP-server change the Message-ID of messages
and put the original Message-ID to X-Microsoft-Original-Message-ID.
the changed Message-ID has some issues:
- outgoing messages with bcc_self enabled are shown twice
as the self-copy got the changed Message-ID while the database uses
the original one
- read receipts do not work as they refer to the changed message id
- in general, sender and recipient see different Message-IDs
the issues can be fixed by
(1) let all receivers use the original Message-ID
this is what this pr is doing
and this should fix all issues with delta-to-delta communication,
including groups, group-images etc.
there may be issues left in communication
with other MUAs as they are using another Message-ID.
(2) ftr: updating the Message-ID in the database of the sender to the new one
this requires bcc_self always enabled (which is not the case)
and may also result easily in race conditions
(Bob answers before Alice sees its self-sent message),
however, has the advantage of better compatibility with other MUA.
if needed, the compatibility with other MUA could be improved by remembering
both Messages-IDs, maybe we could treat the modified as References or so,
however, i think, this could be part of another PR if we know better about
real, in the wild issues.
This commit is contained in:
@@ -950,7 +950,8 @@ impl MimeMessage {
|
||||
}
|
||||
|
||||
pub fn get_rfc724_mid(&self) -> Option<String> {
|
||||
self.get(HeaderDef::MessageId)
|
||||
self.get(HeaderDef::XMicrosoftOriginalMessageId)
|
||||
.or_else(|| self.get(HeaderDef::MessageId))
|
||||
.and_then(|msgid| parse_message_id(msgid).ok())
|
||||
}
|
||||
|
||||
@@ -2749,4 +2750,27 @@ On 2020-10-25, Bob wrote:
|
||||
"mime-modified test – mime-modified *set*; simplify is always regarded as lossy."
|
||||
);
|
||||
}
|
||||
|
||||
#[async_std::test]
|
||||
async fn test_x_microsoft_original_message_id() {
|
||||
let t = TestContext::new().await;
|
||||
let message = MimeMessage::from_bytes(&t, b"Date: Wed, 17 Feb 2021 15:45:15 +0000\n\
|
||||
Chat-Version: 1.0\n\
|
||||
Message-ID: <DBAPR03MB1180CE51A1BFE265BD018D4790869@DBAPR03MB6691.eurprd03.prod.outlook.com>\n\
|
||||
To: Bob <bob@example.org>\n\
|
||||
From: Alice <alice@example.org>\n\
|
||||
Subject: Message from Alice\n\
|
||||
Content-Type: text/plain\n\
|
||||
X-Microsoft-Original-Message-ID: <Mr.6Dx7ITn4w38.n9j7epIcuQI@outlook.com>\n\
|
||||
MIME-Version: 1.0\n\
|
||||
\n\
|
||||
Does it work with outlook now?\n\
|
||||
")
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
message.get_rfc724_mid(),
|
||||
Some("Mr.6Dx7ITn4w38.n9j7epIcuQI@outlook.com".to_string())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user