Lefts partially downloaded message in the local cache
When receiving messages from an unreliable ews connection, it seems it is possible for the local copy of a message to have a corrupted S/MIME part.
Test Case: When running Evolution and receiving messages from an ews account, the network connection was unexpectedly terminated or otherwise unreliable. The receive operation was performed using the wifi provided by a moving train. At least one message was shown in the ews account's Inbox with the expected header information including From, Subject, and Date. However, when the message was opened in Evolution the body reported that the encrypted part of the message could not be shown and that it was corrupted.
Work-around: I could not figure out how to clear the cached local copy of the message directly. Therefore, I marked the message deleted in the Inbox. It seems doing this caused the server to move the message on the server side to the Deleted Items on the server. When opening Deleted Items in Evolution with a good network connection, the message then appeared locally and opened as expected without any corruption. The S/MIME encrypted part was verified and rendered as expected. I then moved the message from Deleted Items back to Inbox. After this sequence, Evolution seems to then re-download the copy into Inbox and that copy was intact.
Desired Behavior: It seems that the full download of messages from ews is not completely transactional. I suspect the headers downloaded and then the body or S/MIME part failed to download. In this scenario, the local copy should have been deleted and not shown as it was not fully retrieved. Displaying the message header in the Inbox with incomplete body parts is misleading as the user experience implies that the message itself is corrupted rather than just the local copy of the message. Instead, the retrieve operation should verify all checksums with the server for all parts of a message before the data is saved to the local cache.
This is a difficult issue to reproduce. Perhaps the code could just be quickly reviewed to see if all message parts and attachments are being verified as correct before the local cache is updated and the message shown in the message list for a folder.
Test System: CentOS 7.5.1804, evolution-data-server-3.22.7-8.el7.x86_64, evolution-3.22.6-14.el7.x86_64, evolution-ews-3.22.6-6.el7.x86_64