jstedfast / MailKit

A cross-platform .NET library for IMAP, POP3, and SMTP.

Home Page:http://www.mimekit.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Syntax error in CAPABILITIES. Unexpected token: '+'

jpmaistrebazin opened this issue · comments

Description
Since version 4.2.0, when I connect to the server I have got this error

Syntax error in CAPABILITIES. Unexpected token: '+'

Exception
MailKit.Net.Imap.ImapProtocolException: Syntax error in CAPABILITIES. Unexpected token: '+'
at MailKit.Net.Imap.ImapEngine.AssertToken(ImapToken token, ImapTokenType type, String format, Object[] args)
at MailKit.Net.Imap.ImapEngine.UpdateCapabilitiesAsync(ImapTokenType sentinel, CancellationToken cancellationToken)
at MailKit.Net.Imap.ImapEngine.ProcessUntaggedResponseAsync(CancellationToken cancellationToken)
at MailKit.Net.Imap.ImapCommand.StepAsync()
at MailKit.Net.Imap.ImapEngine.IterateAsync()
at MailKit.Net.Imap.ImapEngine.RunAsync(ImapCommand ic)
at MailKit.Net.Imap.ImapClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, CancellationToken cancellationToken)

To Reproduce

[Fact]
    public async Task Connect_Test()
    {
        try
        {
            const string fileLogging = "log.log";
            var logger = new ProtocolLogger(fileLogging);
            using var client = new ImapClient(logger);

            const string host = "mail.infomaniak.com";
            const int port = 993;
            const bool useSsl = true;
        
            await client.ConnectAsync(
                host,
                port,
                useSsl);

            const string user = "";
            const string password = "";
        
            await client.AuthenticateAsync(user, password);

            await client.DisconnectAsync(true);
        }
        catch (Exception e)
        {
            System.Diagnostics.Debug.WriteLine(e.Message);
        }
        
    }

ProtocolLogger
Connected to imaps://mail.infomaniak.com:993/
S: * OK IMAP4 ready
C: A00000000 CAPABILITY
S: * CAPABILITY IMAP4rev1 UIDPLUS IDLE LITERAL + QUOTA AUTH=PLAIN AUTH=LOGIN
S: A00000000 OK completed

Wait, is there literally a space between LITERAL and +?

This is a duplicate of issue #1654

It looks like each of your IMAP servers has the exact same bug. I wonder if you guys are using the same IMAP server.