Sync deleted emails with Gmail

Florian Gamböck ml at
Tue Aug 16 19:31:12 BST 2016

Hi Nicolas,

On 2016-08-15 22:21, Nicolas Sebrecht wrote:
> Are you sure about that? Emails moved to the trash will be re-uploaded 
> and a new UID will be assigned while not from a UID MOVE command. 
> I don't know if Gmail will detect the emails are the same and react 
> accordingly. If so, I have no idea the rules they use to do this. 
> Headers signature? Perfect content match?

although the "deleted" mail will get a new UID, the content stays the 
same. I ran a few tests just now to confirm to what degree the messages 
have to match.

If the mails are identical in content and header, then Gmail will detect 
this and removes every single label of a mail it finds in [Gmail]/Trash. 
It even works when the body is slightly altered (I added a single 
character to the end of the body), as long as the Message-Id and the 
Subject header match, there seems to be some kind of tolerance on the 
body. It did *not* work when I added another word on a new paragraph. It 
also didn't work when I changed either the Message-Id or the Subject 

So to sum it up: For the pure purpose of deleting a message, it is 
totally sufficient to copy/move the email to the [Gmail]/Trash folder 
and let Gmail do its black magic behind the curtains. After a maximum of 
two invocations of offlineimap -- one for uploading the message to 
trash, the second for getting information about the deleted mails in the 
other folders -- the only copy that remains is in said trash folder and 
will be purged by Google after about 30 days.



More information about the OfflineIMAP-project mailing list