From f6e819d2a5ee72fc89a28678baae0d16aec4b105 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Thu, 25 Jun 2026 19:06:22 +0200 Subject: [PATCH] refactor: improve comment (#8366) It's unclear whether this logic works, but I think we should at least properly document why it exists (I already sent this text while figuring out what the code does, so it was easy making this PR now) Could add a XXX note that it's unsure whether this works --- src/receive_imf.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/receive_imf.rs b/src/receive_imf.rs index f5f9a0525..012106eef 100644 --- a/src/receive_imf.rs +++ b/src/receive_imf.rs @@ -545,8 +545,15 @@ pub(crate) async fn receive_imf_inner( if mime_parser.incoming { return Ok(None); } - // For the case if we missed a successful SMTP response. Be optimistic that the message is - // delivered also. + + // It sometimes happens that a slow server (usually a classical email server) + // receives a message via SMTP, + // but then the connection to the server dies before it sends the OK response. + // In order to handle this case, we delete the SMTP send jobs if we receive our own message via IMAP. + // + // Now, messages with long recipient lists are split into multiple SMTP jobs. + // In this case, we only want to delete the SMTP job that was sent to self + // because this is the only chunk we can be sure was sent out. let self_addr = context.get_primary_self_addr().await?; context .sql