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

client.Inbox returns null #37

Closed
joancaron opened this issue Apr 14, 2014 · 2 comments
Closed

client.Inbox returns null #37

joancaron opened this issue Apr 14, 2014 · 2 comments

Comments

@joancaron
Copy link

Hi Jeff,
I am facing a problem with only one of my mailboxes.
When I use the sample code shown on the repo's homepage (IMAP section)

// The Inbox folder is always available on all IMAP servers...
var inbox = client.Inbox;

inbox variable returns null.

After inspection of the code, it appears that the problem is in the "QuerySpecialFolders" method (ImapEngine.cs)

if (!FolderCache.TryGetValue ("INBOX", out folder)) {
    //Some Code
    Inbox = list.Count > 0 ? list[0] : null;
}

With this email account FolderCache already contains Inbox folder, therefore the Inbox variable is never assigned.

Workaround :

if (!FolderCache.TryGetValue ("INBOX", out folder)) {
    // Some code
}else {
    Inbox = folder;
}

Now it works but I don't know if it's the right way..
I can create an email account for Tests if you need it

jstedfast added a commit that referenced this issue Apr 14, 2014
@jstedfast
Copy link
Owner

Your fix is absolutely correct - thanks!

I'm guessing that your IMAP server uses INBOX as the namespace? (probably Cyrus IMAP?)

@joancaron
Copy link
Author

Yes this IMAP uses INBOX as the namespace! (OVH)

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