Sync mail deletion with Notmuch + mbsync for gmail
aaermolov at gmail.com
aaermolov at gmail.com
Wed Sep 21 05:35:23 PDT 2016
Hi Sebastian,
I also use mbsync + notmuch
here is mbsync config for my personal Gmail mailbox:
=====================================================
SyncState *
IMAPAccount aaermolov at gmail.com
Host imap.gmail.com
User aaermolov at gmail.com
PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/docs/enc/cred/aaermolov at gmail.com.gpg"
CertificateFile /etc/ssl/certs/ca-certificates.crt
SSLType IMAPS
IMAPStore aaermolov at gmail.com-remote
Account aaermolov at gmail.com
MaildirStore aaermolov at gmail.com-local
Path ~/Maildir/aaermolov at gmail.com/
Inbox ~/Maildir/aaermolov at gmail.com/INBOX
SubFolders Verbatim
MaildirStore aaermolov at gmail.com-archive
Path ~/Maildir/archive-aaermolov at gmail.com/
Channel aaermolov at gmail.com-archive
Master ":aaermolov at gmail.com-remote:[Gmail]/All Mail"
Slave ":aaermolov at gmail.com-archive:Archive"
Create Slave
SyncState *
Sync Push Flags
Channel aaermolov at gmail.com-trash
Master ":aaermolov at gmail.com-remote:[Gmail]/Trash"
Slave ":aaermolov at gmail.com-archive:Trash"
Create Slave
Sync All
Channel aaermolov at gmail.com-drafts
Master ":aaermolov at gmail.com-remote:[Gmail]/Drafts"
Slave ":aaermolov at gmail.com-local:Drafts"
Create Slave
Sync All
Expunge Both
Channel aaermolov at gmail.com-sent
Master ":aaermolov at gmail.com-remote:[Gmail]/Sent Mail"
Slave ":aaermolov at gmail.com-local:Sent"
Create Slave
Sync All
Expunge Both
Channel aaermolov at gmail.com-inbox
Master ":aaermolov at gmail.com-remote:INBOX"
Slave ":aaermolov at gmail.com-local:INBOX"
Create Slave
Sync All
Expunge Both
Channel aaermolov at gmail.com-user-labels
Master :aaermolov at gmail.com-remote:
Slave :aaermolov at gmail.com-local:
Create Slave
Sync All
Patterns "*" "!Drafts" "!Sent" "!Trash" "![Gmail]*" "!INBOX" "!Lists*" "!Cron*"
Expunge Both
Channel aaermolov at gmail.com-mailing-lists-and-notifications
Master :aaermolov at gmail.com-remote:
Slave :aaermolov at gmail.com-local:
Create Slave
Sync All
Patterns "Lists*" "Cron*"
# MaxMessages 2000
Expunge Both
Group aaermolov at gmail.com
Channel aaermolov at gmail.com-trash
Channel aaermolov at gmail.com-inbox
Channel aaermolov at gmail.com-drafts
Channel aaermolov at gmail.com-sent
Channel aaermolov at gmail.com-user-labels
Channel aaermolov at gmail.com-mailing-lists-and-notifications
Channel aaermolov at gmail.com-archive
=====================================================
But I also use imapfilter for trashed and spam messages management, so
when I delete something locally, AFAIK it correctly propagates to Gmail.
Here is imapfilter's config:
=====================================================
options.timeout = 120
options.subscribe = true
cmd_personal = io.popen('gpg2 -q --for-your-eyes-only --no-tty -d ~/docs/enc/cred/aaermolov at gmail.com.gpg', 'r')
out_personal = cmd_personal:read('*a')
pass_personal = string.gsub(out_personal, '[\n\r]+', '')
account_personal = IMAP {
server = 'imap.gmail.com',
username = 'aaermolov at gmail.com',
password = pass_personal,
ssl = 'ssl3'
}
trash_personal = account_personal['[Gmail]/Trash']:is_undeleted()
account_personal['[Gmail]/Trash']:delete_messages(trash_personal)
spam_personal = account_personal['[Gmail]/Spam']:is_unanswered()
account_personal['[Gmail]/Spam']:delete_messages(spam_personal)
=====================================================
Cheers, Alex
PS Sorry for double posting, have forgot all recepients the first time.
Sebastian Fischmeister <sfischme at uwaterloo.ca> writes:
> Hi,
>
> I use mbsync + notmuch to sync my gmail. The problem is that Google's
> IMAP implementation is non-standard and when I deleted a file locally,
> mbsync propagates the deletion, but gmail doesn't delete the
> message.
>
> This is part of mbsync:
>
> SyncState *
> Sync All
> Expunge Both
> Create Both
>
> When I delete a message, the macro passes the tag 'delete'. Before
> syncing, the script runs:
>
> notmuch search --output=files tag:delete | xargs -l rm
>
> By playing with the IMAP settings in gmail, I got it so that the mail
> vanishes from the 'inbox' label, but it's still in 'All Mails'. I also
> tried moving it to a "[GMail]/Trash" folder locally and syncing that,
> but it didn't work.
>
> Any ideas?
>
> Sebastian
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch
More information about the notmuch
mailing list