Question: Corrupted headers in Mail when moving messages between Gmail accounts
Ever since Mac OS X 10.11, I have had a problem with using Apple Mail / Mail.app with Gmail accounts using IMAP on Mac OS X.
What happens is this:
When I move messages into mail on the client side, aspects of the messages are jumbled. For example, if I have five messages in an inbox, flag one of them, and then drag all five to a particular mailbox, then look in that mailbox, the flag will usually move to another message.
Alternatively, I have quite a lot of client-side "rules" in Apple Mail to move messages to mailboxes based on certain criteria. When Apple Mail downloads my mail, rules are applied and messages are moved as appropriate. When more than 1 or 2 messages are moved between Gmail mailboxes, I find the indices are often corrupted. E.g., If I get messages from Alice, Bob, and Charlie, the message that Alice sent may show as coming from Bob (and if I try to reply, it tries to reply to Bob), and vice versa.
These behaviors only seem to happen with the Gmail mailboxes, and not with IMAP accounts from other providers (e.g., iCloud, Fastmail).
Messages are not similarly jumbled when Apple Mail simply downloads messages -- e.g., if messages are moved or flagged on the server side.
Thus, there seems to be a problem when Apple Mail moves messages between Gmail mailboxes that began with 10.11 and has continued to the current 10.13.2.
The temporary fix is rebuilding mailboxes, and for the past few months, it has often been the case that I have frequently had to rebuild multiple mailboxes each time I open Apple Mail to download new mail, which can be several times per day.
Things that do not solve the issue include:
- Removing the Envelope Indices, which I have tried multiple times,
- Reindexing Spotlight, which I have tried multiple times.
- Creating another user on the same machine, and adding the Gmail accounts to that user.
- Setting up mail accounts on another machine.
Since it happens with more than one machine, it does not seem like there is something wrong with my OS
I'm wondering if this is a known problem between Apple Mail or Gmail, or if there's something else sync'd via iCloud in Mail settings that is fundamentally corrupt.
Here is a specific example -- with Apple Mail closed, I sent myself four messages via the Gmail web interface that had these subjects and bodies:
Subject: GMLC UCD 1 Body: GMLC UCD 1
Subject: GMLC UCD 2 Body: GMLC UCD 2
Subject: GMLC LBNL 1 Body: GMLC LBNL 1
Subject: GMLC LBNL 2 Body: GMLC LBNL 2
However, after turning on Apple Mail and having it automatically filter via Rules into a mailbox, they then showed up in having these subjects and bodies:
Subject: GMLC UCD 1 Body: GMLC LBL2
Subject: GMLC UCD 2 Body: GMLC LBL 1
(the other two were missing)
Note that when viewing via the Gmail web interface, the subjects and bodies matched those sent. This ONLY appears jumbled via Apple Mail.
Has anyone else seen this problem, and, ideally, found a resolution, other than switching to a third-party mail client for Gmail accounts? I should add that I contact Apple about this probably a year ago and they asked for various enhanced debug log capture that they were going to send to engineering, but nothing ever came of it.
MacBook Pro (15-inch, Late 2016), macOS High Sierra (10.13.2), null