fix: send legacy securejoin key requests as multipart/mixed

chatmail relays (filtermail) expect {vc,vg}-request
messages to be multipart/mixed with a single part.
Messages had this structure
before commit e0494b0b37
so we need to keep it for compatibility.
This commit is contained in:
link2xt
2026-08-20 00:22:50 +00:00
committed by l
parent f09f8fd8a4
commit 3df1e3712a
2 changed files with 22 additions and 0 deletions

View File

@@ -1560,6 +1560,23 @@ impl MimeFactory {
// that normally only allows encrypted mails.
message
} else {
// Unencrypted message.
let message = if let Loaded::Message { msg, .. } = &self.loaded
&& msg.param.get_cmd() == SystemMessage::SecurejoinMessage
&& matches!(
msg.param.get(Param::Arg),
Some("vc-request") | Some("vg-request")
) {
// Workaround for legacy SecureJoin {vc,vg}-request messages.
// They must be sent as multipart/mixed
// for compatibility with chatmail relays
// that allow to send these messages unencrypted,
// but only as long as they have this MIME structure.
MimePart::new("multipart/mixed", vec![message])
} else {
message
};
headers.iter().fold(message, |message, (header, value)| {
debug_assert_ne!(*header, "from");
debug_assert_ne!(*header, "message-id");

View File

@@ -494,6 +494,11 @@ async fn test_secure_join_group_ext(v3: bool, remove_invite: bool) -> Result<()>
"vg-request"
}
);
if !v3 {
// Legacy {vc,vg}-request should be sent as multipart/mixed
// to pass chatmail relay filters.
assert!(sent.payload.contains("Content-Type: multipart/mixed"));
}
assert_eq!(msg.get_header(HeaderDef::SecureJoinAuth).is_some(), v3);
assert_eq!(
msg.get_header(HeaderDef::SecureJoinInvitenumber).is_some(),