Moving and marking unread in one sync with gmail

483 views
Skip to first unread message

Jay Kamat

unread,
May 26, 2018, 3:01:31 AM5/26/18
to mu-discuss
Hi!

I have mu4e set up, and I'm loving it so far, but I'm running into one odd issue.

If I receive an email, and read it, and decide to refile or move it to trash, it appears to work just fine from mu4e. However, upon syncing, the "mark as read" dosen't seem to get propogated to the server (but the move does), and the message gets marked as unread again.

If I read a message, sync, refile message, and sync again, I don't have this issue.

Does anyone have any hints on where I can start looking to troubleshoot this? I've tried both mbsync and offlineimap and they both seem to have the problem.

If it matters, I'm using gmail's imap support.

Thanks,
-Jay

Eduardo Mercovich

unread,
May 31, 2018, 8:45:47 AM5/31/18
to mu-di...@googlegroups.com
Hi Jay.

> [...] If I receive an email, and read it, and decide to refile
> or move it to
> trash, it appears to work just fine from mu4e. However, upon
> syncing,
> the "mark as read" dosen't seem to get propogated to the server
> (but
> the move does), and the message gets marked as unread again.

[...]

> Does anyone have any hints on where I can start looking to
> troubleshoot this? I've tried both mbsync and offlineimap and
> they
> both seem to have the problem.

I use mbsync (much faster and lighter than offlineimap, BTW) and
never had this issue.
Maybe if you share your configuration (without private info) we
can peek a bit into what can be causing this...

Best.


--
Eduardo Mercovich

Donde se cruzan tus talentos
con las necesidades del mundo,
ahí está tu vocación.
(Anónimo)

Jay Kamat

unread,
May 31, 2018, 1:26:19 PM5/31/18
to mu-di...@googlegroups.com
Hi Eduardo,

Eduardo Mercovich writes:

> I use mbsync (much faster and lighter than offlineimap, BTW) and never had
> this issue. Maybe if you share your configuration (without private info) we
> can peek a bit into what can be causing this...

Sorry, I should have included that in my initial email :)

Mbsync: https://github.com/jgkamat/dotfiles/blob/master/emacs/.mbsyncrc
mu4e: https://github.com/jgkamat/dotfiles/blob/master/emacs/.emacs.d/lisp/mu4e-config.el

I can reproduce this with a much smaller mu4e config and emacs -q (setting my
maildir, folders, and (setq mu4e-change-filenames-when-moving t)), so I think
this might be something wrong with my mbsync config.

Here are my IMAP settings in gmail as well, I tried tuning them to what was
recommended in the mbsync man page, but that didn't help too much.

https://u.cubeupload.com/jgkamat/QQnt83.png

For some reason, adding Expunge Both makes it impossible for me to move
messages to trash.

I'm still pretty confused how the mbsyncrc file works, so any help would be
appreciated.

Thanks,
-Jay

Eduardo Mercovich

unread,
Jun 6, 2018, 8:31:36 AM6/6/18
to mu-di...@googlegroups.com
Hi Jay.

[...]

> I can reproduce this with a much smaller mu4e config and emacs
> -q (setting my maildir, folders, and (setq
> mu4e-change-filenames-when-moving t)), so I think this might be
> something wrong with my mbsync config.
> [...] I'm still pretty confused how the mbsyncrc file works, so
> any help would be appreciated.

I use mbsync too (much lighter in resources and faster) and it's
config seems pretty straightforward...

Here is my commented config, in case it's useful.

--8<---------------cut here---------------start------------->8---
IMAPAccount your-account-name
Host imap.gmail.com
User y...@your-domain.org
Pass your-password
SSLType IMAPS
# at least in linux, here are the certificates.
CertificateFile /etc/ssl/certs/ca-certificates.crt

# Defining remote access/server
IMAPStore your-account-name-remote
Account your-account-name

# Defining local filesystem "repo"/maildir
# at least in linux, the stadard path is ~/Maildir
# under that directory is 1 directory per account
MaildirStore your-account-name-local
Path ~/Maildir/your-account-name/
Inbox ~/Maildir/your-account-name/inbox

# Now we define channels (~folders exposed by the IMAP server).
# Gmail does it with labels, exposing each one as folders
# (which ones are exposed is managed in Settings > Labels).
# Here we sync only inbox, trash, drafts, starred and all
# so as to minimize duplication and just use mu4e saved
# searches in the "All" folder for easy access.
# We also rename them to make them shorter and easier in
# case typing is needed ("[Gmail]/Papelera" > trash).
# Defining each channel also allows to check them separately,
# for example, inbox only every 5 minutes, all of them every 20.

Channel your-account-name-inbox
Master :your-account-name-remote:
Slave :your-account-name-local:
Patterns "INBOX"
Create Both
Expunge Both
SyncState *

Channel your-account-name-trash
Master :your-account-name-remote:"[Gmail]/Papelera"
Slave :your-account-name-local:trash
Create Both
Expunge Both
SyncState *

Channel your-account-name-drafts
Master :your-account-name-remote:"[Gmail]/Borradores"
Slave :your-account-name-local:drafts
Create Both
Expunge Both
SyncState *

Channel your-account-name-starred
Master :your-account-name-remote:"[Gmail]/Destacados"
Slave :your-account-name-local:starred
Create Both
Expunge Both
SyncState *

Channel your-account-name-todos
Master :your-account-name-remote:"[Gmail]/Todos"
Slave :your-account-name-local:todos
Create Both
Expunge Both
SyncState *

# And now we group the channels we'd like to check together
# with this account's name.
Group your-account-name
Channel your-account-name-inbox
Channel your-account-name-trash
Channel your-account-name-drafts
Channel your-account-name-starred
Channel your-account-name-todos
--8<---------------cut here---------------end--------------->8---

HTH. :)

Jay Kamat

unread,
Jun 8, 2018, 1:35:55 PM6/8/18
to mu-di...@googlegroups.com
I'm still seeing this issue with this minimal mbsync configuration file
(and moving messages with m -> /test after viewing them).

# -*- mode: conf;-*-
IMAPAccount gmail
Host imap.gmail.com
User jayg...@gmail.com
PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mbsyncpass.gpg"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

IMAPStore gmail-remote
Account gmail

MaildirStore gmail-local
Path ~/.mail/gmail/
Inbox ~/.mail/gmail/INBOX

Channel gmail-inbox
Master :gmail-remote:
Slave :gmail-local:
Patterns "INBOX"
Create Both
Expunge Both
SyncState *
Sync All

Channel gmail-test
Master :gmail-remote:"test"
Slave :gmail-local:test
Create Both
Expunge Both
SyncState *
Sync All

Group gmail
Channel gmail-inbox
Channel gmail-test

I think I'm going to try setting up notmuch to find if I see the problem
there as well. At this point I'm starting to think my gmail account is
cursed...

-Jay

Erik Colson

unread,
Jun 8, 2018, 4:26:56 PM6/8/18
to mu-di...@googlegroups.com

Jay Kamat <jayg...@gmail.com> writes:

> Hi!
>
> I have mu4e set up, and I'm loving it so far, but I'm running into one odd
> issue.
>
> If I receive an email, and read it, and decide to refile or move it to
> trash, it appears to work just fine from mu4e. However, upon syncing, the
> "mark as read" dosen't seem to get propogated to the server (but the move
> does), and the message gets marked as unread again.

Hi Jay,

I might be wrong but it appears to me you perhaps are trying to make MU
execute 2 actions at once on a mail. MU will only execute the last
action you entered...

best
--
erik colson

Jay Kamat

unread,
Jun 8, 2018, 7:58:13 PM6/8/18
to mu-di...@googlegroups.com


Erik Colson writes:

> I might be wrong but it appears to me you perhaps are trying to make MU
> execute 2 actions at once on a mail. MU will only execute the last action
> you entered...

Unfortunately, that dosen't seem to be the issue for me, even when marking as
read, committing (by quitting and returning to inbox) and moving/trashing after
that, I still see this issue.

-Jay

Dirk-Jan C. Binnema

unread,
Jun 10, 2018, 11:48:29 AM6/10/18
to mu-di...@googlegroups.com
Best guess: check the earlier questions / answers on this very same
issue (search for 'mbsync').

Basically (see those other posts for details):

1. verify that things work on the mu side (i.e., messages end up in the
right place)
2.- see what happens after you sync.

In almost all cases, it seems (2) is the culprit -- i.e., mbsync (or
offlineimap, or ... ) have a bit different idea of what the message
flags mean or do something special with syncing.

If those posts don't help, probably best to (1), then ask the mbsync
people, since its outside mu's scope. Unless of course there's some
evidence that mu's misbehaving.

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:dj...@djcbsoftware.nl w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

Kourosh Kalayeh

unread,
Apr 1, 2024, 10:49:08 PMApr 1
to mu-discuss
Hi, 

I was wondering if you have found a way to deal with this and if you are willing to share? 
I am having the exact same problem with mu 1.12 and offlineimap. 

Thanks, 
Kourosh 

Jay Kamat

unread,
Apr 1, 2024, 10:53:36 PMApr 1
to mu-di...@googlegroups.com, Kourosh Kalayeh

Kourosh Kalayeh <k.ka...@gmail.com> writes:

> I was wondering if you have found a way to deal with this and if you are
> willing to share?

Unfortunately still no solution on my end - I've just accepted the behavior.
I'd be as interested as you are in a solution!

-Jay

Kourosh Kalayeh

unread,
Apr 2, 2024, 11:17:09 AMApr 2
to Jay Kamat, mu-di...@googlegroups.com
How about if we redefine the refile action so it automatically mark everything as read when refiling? Does anyone knows that this is a reasonable approach? I stole the idea from redefining the delete action for Gmail.

Something like below?

(setf (alist-get 'refile mu4e-marks)
((list :char
("r" . "▶")
:prompt "refile" :dyn-target
(lambda
(target msg)
(mu4e-get-refile-folder msg))
:action
(lambda
(docid msg target)
(mu4e--server-move docid
(mu4e--mark-check-target target)
"+S-u-N")))))

Thanks,
Kourosh

Jerry Lee Daniel

unread,
May 7, 2024, 5:40:22 AMMay 7
to mu-discuss
Loans, Project and Digital Investment financing available up to $150m.
Have a Business Plan, Fundable Project and Collateral.

Contact: danielj...@gmail.com
Whatsapp: ‪+1 (918) 707‑0858
Reply all
Reply to author
Forward
0 new messages