Mbsync downloads oldest messages first instead of newest

125 Views Asked by At

I have a script that downloads my emails locally using mbsync, and then processes any emails that are marked as unread (marking them read, once completed). To avoid lengthy downloads I set this to only download the most recent 50.

My email folder has 1000 emails, 4 that are unread (which are the most recent).

Today I've noticed that mbsync is now pulling the emails from oldest first, vs newest, which means no emails get processed. I haven't amended anything with my code, only updated an email filter, to grab another email subject to my folder. Reverting this did nothing.

Is there a setting I can use to pull newest first or if this is some habit with gmail that I am unaware of, where new labels mess things up?

Below is a copy of my mbsync file, which should be correct based on my googling.

SyncState *

MaildirStore local,discreps
Path DIR/discrepancy/

IMAPAccount discreps
AuthMechs LOGIN
Host smtp.gmail.com
User EMAIL
Pass PWORD
SSLType IMAPS
SSLVersions TLSv1.2

IMAPStore discreps
Account discreps

Channel discreps,allmail
Master :discreps:"discrepancies"
Slave :local,discreps:discrepancy_emails
Create Slave
MaxMessages 50
ExpireUnread yes
CopyArrivalDate yes

Group discreps
Channels discreps,allmail
1

There are 1 best solutions below

0
On

Seems Gmail has some weird behaviour that causes new filters, to mess with mbsync. After a day the issue seemed to resolve itself, and occur again if I made any new filters that affected folders (again resolving itself after a day.