jstedfast / MailKit

A cross-platform .NET library for IMAP, POP3, and SMTP.
http://www.mimekit.net
MIT License
6.04k stars 809 forks source link

IMAP client connected and authenticated but Inbox returns null #1741

Closed nataliaheliova closed 3 months ago

nataliaheliova commented 3 months ago

I have very simple code which just connects to imap server and succesfully authenticates. However Inbox property of ImapClient returns null.

Platform:

ImapClient client = new ImapClient();
client.Connect(imapServer, imapPort);
client.Authenticate(imapUsername, imapPassword);
var inbox = client.Inbox;
client.Disconnect(true);

Protocol Logs Connected to imap://mailslurp.click:1143/?starttls=when-available S: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR CHILDREN UNSELECT MOVE APPENDLIMIT AUTH=PLAIN] IMAP4rev1 Service Ready C: A00000000 AUTHENTICATE PLAIN **** S: A00000000 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR CHILDREN UNSELECT MOVE APPENDLIMIT] AUTHENTICATE completed C: A00000001 LIST "" "" S: LIST (\Noselect) "/" "/" S: A00000001 OK LIST completed C: A00000002 LIST "" "INBOX" S: A00000002 OK LIST completed C: A00000003 LOGOUT S: BYE Closing connection S: A00000003 OK LOGOUT completed

As you can see from the log, I am using MailSlurp. Is this server compatible with MailKit? Is it expected that Inbox returns null? Thanks!

jstedfast commented 3 months ago

When MailKit tries to list the INBOX, the server doesn't return it in the listing (the listing is empty).

That suggests it doesn't exist.

Your server is broken, imho.

jackmahoney commented 3 months ago

Hi, I work for MailSlurp, there may be a bug in our imap server when selecting for INBOX, I will check and post and update here

jackmahoney commented 3 months ago

@nataliaheliova we have deployed a fix to the MailSlurp imap inbox so that INBOX select works. Can you please retry?

nataliaheliova commented 3 months ago

It works. Cool! Thanks a lot :))