Mailspring-Sync icon indicating copy to clipboard operation
Mailspring-Sync copied to clipboard

Outlook: Duplication of Sent Mail

Open CodeMouse92 opened this issue 4 years ago • 6 comments

Objective

Sent mails are duplicating in Microsoft-based email accounts, one per recipient, plus one created by Mailspring.

Testing Notes

This needs to be tested with Outlook accounts. There are plenty of reporters who can verify the fix (as can I).

Tips

The code responsible for moving mail to sent is in Mailspring-Sync/MailSync/TaskProcessor.cpp:1442-1536. I’m going to dig into a bit, and see if I can figure out what’s going wrong, as it is supposed to prevent duplication of sent messages.

References

https://community.getmailspring.com/t/duplication-of-sent-mail/275

CodeMouse92 avatar Feb 16 '21 22:02 CodeMouse92

86421 [2021-02-16 14:31:20.295] [foreground] [info] -- No messages found. Sleeping 1 to wait for sent folder to settle...
86421 [2021-02-16 14:31:21.401] [foreground] [info] -- No messages found. Sleeping 1 to wait for sent folder to settle...
86421 [2021-02-16 14:31:22.508] [foreground] [info] -- No messages found. Sleeping 2 to wait for sent folder to settle...
86421 [2021-02-16 14:31:24.660] [foreground] [info] -- No messages matching the message-id were found in the Sent folder.
86421 [2021-02-16 14:31:24.660] [foreground] [info] -- Placing a new message with `self` body in the sent folder.
86421 [2021-02-16 14:31:24.765] [foreground] [info] -- Syncing sent message (UID 1355) to the local mail store

With Outlook-based accounts, findUIDsOfRecentHeaderMessageID() is failing.

        while (tries < 4 && uids->count() == 0) {
            if (delay[tries]) {
                logger->info("-- No messages found. Sleeping {} to wait for sent folder to settle...", delay[tries]);
				std::this_thread::sleep_for(std::chrono::seconds(delay[tries]));
            }
            tries ++;
            session->findUIDsOfRecentHeaderMessageID(sentPath, AS_MCSTR(draft.headerMessageId()), uids);
        }
    
        if (multisend && (uids->count() > 0)) {
            // ...
        } else if (!multisend && (uids->count() == 1)) {
            // ...
        } else {
            logger->info("-- No messages matching the message-id were found in the Sent folder.", uids->count());
        }

Still digging...

CodeMouse92 avatar Feb 16 '21 22:02 CodeMouse92

Based on the logs, it was looking for UID 1355. However, according to later logs, UID 1356 was the correct UID for the message?

86421 [2021-02-16 14:50:30.745] [background] [info] syncFolderChangesViaCondstore - Sent: modseq 1426 to 1426, uidnext 1356 to 1356

@bengotow One possibility is that there's an off-by-one error with Outlook sent mail UIDs specifically. However, as I cannot yet build Mailsync on my Ubuntu machine (due to Mailcore2), I have no way to test. I think I'll have to pitch this your way now.

CodeMouse92 avatar Feb 16 '21 23:02 CodeMouse92

Hello. This problem seems to still exist. Is there any plan to fix it any time soon? Thank you

pmpakos avatar Jun 20 '22 10:06 pmpakos

Bump. Bug still exists. I use 3 outlook.com accounts with mailspring and is horrible that each mail is doubled.

DDZ-DO avatar Sep 05 '23 09:09 DDZ-DO

Also bumping, issue exists with 4 Outlook/Exchange accounts I have on latest version, Windows 10.

fusionice avatar Sep 06 '23 13:09 fusionice

Issue still persists on the latest version, Windows 11. Bumping.

prajjwal27 avatar Mar 21 '24 16:03 prajjwal27