Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting Deleted flag on message in Gmail folder throws Protocol Exception #228

Closed
brettmarl opened this issue Aug 14, 2015 · 2 comments
Closed

Comments

@brettmarl
Copy link

Relevant code is:

ImapClient c = new ImapClient();
c.Connect("imap.gmail.com", 993, true);
c.Authenticate(...);

var folderSrc = c.GetFolder("[Gmail]/All Mail");
folderSrc.Open(FolderAccess.ReadWrite);
for (int i = 0; i <folderSrc.Count; i++)
{
    var message = folderSrc.GetMessage(i);
    folderSrc.AddFlags(i, MessageFlags.Deleted, false);
}

AddFlags throws a protocol exception:
[MailKit.Net.Imap.ImapProtocolException] {"Unexpected token in IMAP response: [atom: 0]"}
HResult = 0x80131500

Protocol Logger says:

C: A00000009 STORE 1 +FLAGS (\Deleted)
S: * 1 FETCH (FLAGS (\Deleted) MODSEQ (0))
S: A00000009 OK Success

Server is Gmail on a Google Apps domain.

@jstedfast
Copy link
Owner

The problem is that the modseq value is not allowed to be 0 according to the specs:

   fetch-mod-resp      = "MODSEQ" SP "(" permsg-modsequence ")"
   permsg-modsequence  = mod-sequence-value
                          ;; per message mod-sequence
   mod-sequence-value  = 1*DIGIT
                          ;; Positive unsigned 64-bit integer
                          ;; (mod-sequence)
                          ;; (1 <= n < 18,446,744,073,709,551,615)

@brettmarl
Copy link
Author

sweet - that a quick - thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants