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

Permanent flags not settable #1277

Closed
beepmeep opened this issue Oct 22, 2021 · 2 comments
Closed

Permanent flags not settable #1277

beepmeep opened this issue Oct 22, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@beepmeep
Copy link

beepmeep commented Oct 22, 2021

Describe the bug
I seem to be unable to set Permanent Flags on a ftgate-IMAP Server.

When a '\delete' is issued over 'mailbox.Addflags' the client sends an empty Flag-Store Command to the Server when it should send 'UID STORE +FLAGS ( \deleted )' .

Platform (please complete the following information):

  • OS: Windows
  • .NET Runtime:
  • .NET Framework: .net 6.0
  • MailKit Version: 2.15.0

To Reproduce

            string host = "";
            string password = "";
            string account = "";

            var client = new ImapClient(new ProtocolLogger(Console.OpenStandardOutput()));
            client.Connect(host, 143, SecureSocketOptions.StartTlsWhenAvailable);
            client.Authenticate(account, password);
            Console.WriteLine("Capabilities = {0}", client.Capabilities);

            var inbox = client.Inbox;
            inbox.Open(FolderAccess.ReadWrite);
            Console.WriteLine("PermanentFlags = {0}", inbox.PermanentFlags);
            Console.WriteLine("AcceptedFlags = {0}", inbox.AcceptedFlags);

            var mm = client.Inbox.Search(SearchQuery.All);
            inbox.AddFlags(mm, MessageFlags.Deleted, true);
            inbox.Expunge();

            client.Disconnect(true);

Expected behavior
The mails should receive the '\deleted' flag and be expunged.

Protocol Logs

Connected to xxxxxxxxxxxxxxxxxxxxxxxxxxxx/?starttls=when-available
S: * OK IMAP4 IMAP4rev1 Server
C: A00000000 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4REV1 AUTH=CRAM-MD5 AUTH=LOGIN IDLE XTRASH XLIST
S: A00000000 OK CAPABILITY completed
C: A00000001 AUTHENTICATE CRAM-MD5
....
S: A00000001 OK AUTHorisation successful
C: A00000002 CAPABILITY
S: * CAPABILITY IMAP4 IMAP4REV1 AUTH=CRAM-MD5 AUTH=LOGIN IDLE XTRASH XLIST
S: A00000002 OK CAPABILITY completed
C: A00000003 LIST "" ""
S: * LIST (\NoSelect) "/" ""
S: A00000003 OK List Completed
C: A00000004 LIST "" "INBOX"
S: * LIST (\NoInferiors) NIL INBOX
S: A00000004 OK List Completed
C: A00000005 XLIST "" "*"
S: * LIST (\Drafts) "/" "Drafts"
S: * LIST () "/" "INBOX"
S: * LIST (\Sent) "/" "Sent Items"
S: A00000005 OK List Completed
Capabilities = IMAP4, IMAP4rev1, Status, Idle, XList
C: A00000006 SELECT INBOX
S: * FLAGS (\answered \flagged \deleted \seen \draft)
S: * 3 EXISTS
S: * 3 RECENT
S: * OK [UNSEEN 6] Message 6 is the first unseen
S: * OK [UIDNEXT 9] Predicted next uid
S: * OK [UIDVALIDITY 1634801892] UIDs VALID
S: * OK [PERMANENTFLAGS (\seen \answered \flagged \deleted \draft \new)]
S: A00000006 OK [READ-WRITE] SELECT COMPLETED
PermanentFlags = None
AcceptedFlags = None
C: A00000007 UID SEARCH ALL
S: * SEARCH 6 7 8
S: A00000007 OK Search Complete
C: A00000008 UID STORE 6:8 +FLAGS.SILENT ()
S: A00000008 OK UID STORE completed
C: A00000009 EXPUNGE
S: A00000009 OK EXPUNGE completed
C: A00000010 LOGOUT
S: * BYE Server closing connection
S: A00000010 OK LOGOUT completed

Additional context

  • I am able to set random custom-flags. I tried to 'cheat' the system by issuing the '\deleted' flag over the custom flag system, but MailKit seems to escape known permanent flags in custom-flags.
  • I can delete E-mails fine if i use a telnet-connection.
@jstedfast
Copy link
Owner

The problem is that your IMAP server is using all-lowercase flag names and MailKit was not handling that correctly (It handles it correctly for everything other than flag names, funnily enough).

@jstedfast jstedfast added the bug Something isn't working label Oct 22, 2021
@jstedfast
Copy link
Owner

MailKit v3.0.0 has been released with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants