login about faq

Hello!

I have already written to you about this problem. But didn't get any answer. Sometimes, I can't select mailbox. It's a big problem! I can't get new messages from mailbox in this case and don't know how long it will be. We use chilkat library on different computers, with different imap servers. But in all cases we have the same problem - in some time imap client can't select mailbox. It happens without any specific sequences of actions. Any ideas?

asked Apr 16 '14 at 10:24

kuligintim's gravatar image

kuligintim
316911

edited Apr 16 '14 at 10:24


12next page »

I cannot have any ideas without useful information.

Make sure to test using the latest version of Chilkat, and if the problem is with the call to SelectMailbox, then include the contents of the LastErrorText.

link

answered Apr 16 '14 at 10:39

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I tested imap today and got next results. When I can't select mailfolder I write LastErrorText in to the log file. I got errors in less than 15 minutes in 3 mail accounts. All results the same. LOGS:

test.docs@yandex.ru(17.04.2014 16:32:45): Папка - Новая папка для отправленных, Connected - True, LoggedIn - True
ChilkatLog:
  IsConnected:
    DllDate: Mar  6 2014
    ChilkatVersion: 9.5.0.16
    UnlockPrefix: TOPSYSIMAPMAILQ
    Username: KULIGIN:Kuligin
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
  --IsConnected
--ChilkatLog
link

answered Apr 17 '14 at 09:51

kuligintim's gravatar image

kuligintim
316911

edited Apr 18 '14 at 06:48

This is the LastErrorText for the IsConnected call. The LastErrorText contains information about the last call on the object instance. Make sure to capture the LastErrorText immediately after the desired method call (SelectMailbox) but before making another call on the same object instance.

(Apr 17 '14 at 09:55) chilkat ♦♦

I use only one method for selecting mailbox.

private EmailError SelectMailBox(string folderName)
        {
            if (!_imap.SelectMailbox(folderName))
            {
                string path = Path.Combine(Path.GetTempPath(), string.Format("Exchange({0}).log",  _settings.IMap.Login));
                using (StreamWriter writer = new StreamWriter(path, true))
                {
                    writer.WriteLine("{0}({1}): Папка - {2}, Connected - {3}, LoggedIn - {4}", _settings.IMap.Login, DateTime.Now, folderName, _imap.IsConnected(), _imap.IsLoggedIn());
                    writer.WriteLine(_imap.LastErrorText);
                }

                return Mail.EmailError.SelectMailboxFailed;
            }

            return EmailError.None;
        }

Sorry, I have found the mistake. When I write log I call _imap.IsConnected() :)

I will change this code and will write new log later.

link

answered Apr 17 '14 at 10:00

kuligintim's gravatar image

kuligintim
316911

edited Apr 17 '14 at 10:20

Today I got next errors:

testdocs@outlook.com(18.04.2014 11:32:58): Папка - Deleted, Connected - True, LoggedIn - True
ChilkatLog:
  SelectMailbox:
    DllDate: Mar  6 2014
    ChilkatVersion: 9.5.0.16
    UnlockPrefix: TOPSYSIMAPMAILQ
    Username: KULIGIN:Kuligin
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    mailbox: Deleted
    selectMailboxInner:
      mailboxPath: Deleted
      separatorChar: .
      Escaping quotes and backslashes in mailbox name...
      utf7EncodedMailboxPath: Deleted
      Failed to find OK line in response.
    --selectMailboxInner
    Failed to select/examine mailbox
    mailbox: Deleted
    imapSelectResponse: aaxy BAD Select Command is not permitted in current state (NotAuthenticated)
    Failed.
  --SelectMailbox
--ChilkatLog

testdocs2014@yahoo.com(18.04.2014 11:32:49): Папка - Sent, Connected - True, LoggedIn - True
ChilkatLog:
  SelectMailbox:
    DllDate: Mar  6 2014
    ChilkatVersion: 9.5.0.16
    UnlockPrefix: TOPSYSIMAPMAILQ
    Username: KULIGIN:Kuligin
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    mailbox: Sent
    selectMailboxInner:
      mailboxPath: Sent
      separatorChar: .
      Escaping quotes and backslashes in mailbox name...
      utf7EncodedMailboxPath: Sent
      Failed to find OK line in response.
    --selectMailboxInner
    Failed to select/examine mailbox
    mailbox: Sent
    imapSelectResponse: aavr BAD [CLIENTBUG] Invalid command or arguments
    Failed.
  --SelectMailbox
--ChilkatLog

testdocs@mail.ru(18.04.2014 11:32:56): Папка - INBOX, Connected - True, LoggedIn - True
ChilkatLog:
  SelectMailbox:
    DllDate: Mar  6 2014
    ChilkatVersion: 9.5.0.16
    UnlockPrefix: TOPSYSIMAPMAILQ
    Username: KULIGIN:Kuligin
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    mailbox: INBOX
    selectMailboxInner:
      mailboxPath: INBOX
      separatorChar: .
      Escaping quotes and backslashes in mailbox name...
      utf7EncodedMailboxPath: INBOX
      Failed to find OK line in response.
    --selectMailboxInner
    Failed to select/examine mailbox
    mailbox: INBOX
    imapSelectResponse: aasz BAD [CLIENTBUG] Unrecognised command
    Failed.
  --SelectMailbox
--ChilkatLog

test.docs@yandex.ru(18.04.2014 11:21:30): Папка - Черновики, Connected - True, LoggedIn - True
ChilkatLog:
  SelectMailbox:
    DllDate: Mar  6 2014
    ChilkatVersion: 9.5.0.16
    UnlockPrefix: TOPSYSIMAPMAILQ
    Username: KULIGIN:Kuligin
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    mailbox: Черновики
    selectMailboxInner:
      mailboxPath: Черновики
      separatorChar: .
      Escaping quotes and backslashes in mailbox name...
      utf7EncodedMailboxPath: &BCcENQRABD0EPgQyBDgEOgQ4-
      Failed to find OK line in response.
    --selectMailboxInner
    Failed to select/examine mailbox
    mailbox: Черновики
    imapSelectResponse: aany NO [CLIENTBUG] SELECT not authenticated. sc=RLX3anIipqMc
    Failed.
  --SelectMailbox
--ChilkatLog

test.docs@rambler.ru(18.04.2014 11:32:52): Папка - Отправленные, Connected - True, LoggedIn - True
ChilkatLog:
  SelectMailbox:
    DllDate: Mar  6 2014
    ChilkatVersion: 9.5.0.16
    UnlockPrefix: TOPSYSIMAPMAILQ
    Username: KULIGIN:Kuligin
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    mailbox: Отправленные
    selectMailboxInner:
      mailboxPath: Отправленные
      separatorChar: .
      Escaping quotes and backslashes in mailbox name...
      utf7EncodedMailboxPath: &BB4EQgQ,BEAEMAQyBDsENQQ9BD0ESwQ1-
      Failed to find OK line in response.
    --selectMailboxInner
    Failed to select/examine mailbox
    mailbox: Отправленные
    imapSelectResponse: aatd BAD invalid command
    Failed.
  --SelectMailbox
--ChilkatLog

for_site@tut.by(18.04.2014 11:32:50): Папка - Удаленные, Connected - True, LoggedIn - True
ChilkatLog:
  SelectMailbox:
    DllDate: Mar  6 2014
    ChilkatVersion: 9.5.0.16
    UnlockPrefix: TOPSYSIMAPMAILQ
    Username: KULIGIN:Kuligin
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    mailbox: Удаленные
    selectMailboxInner:
      mailboxPath: Удаленные
      separatorChar: /
      Escaping quotes and backslashes in mailbox name...
      utf7EncodedMailboxPath: &BCMENAQwBDsENQQ9BD0ESwQ1-
      Failed to find OK line in response.
    --selectMailboxInner
    Failed to select/examine mailbox
    mailbox: Удаленные
    imapSelectResponse: abvu BAD Unknown command g50mb58482005eer
    Failed.
  --SelectMailbox
--ChilkatLog
link

answered Apr 18 '14 at 06:54

kuligintim's gravatar image

kuligintim
316911

Investigate by writing code to see what mailboxes exist. You can do this by using the code from this example: http://www.example-code.com/csharp/imap_listMailboxes.asp

Do the mailboxes that are listed match what your program is trying to select?

link

answered Apr 18 '14 at 11:56

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I sync imap folders whith client and use code like this (the same as in example):

 Mailboxes boxes = _imap.ListMailboxes("", "*");
 List<string> names = new List<string>();
 for (int i = 0; i < boxes.Count; i++)
    names.Add(boxes.GetName(i));

I sure that all mailboxes that were listed are exist. Do you know any imap-server without INBOX? I do not. And if mailboxes do not exist I can not get any mails from them, but I can. Problem is that this folders sometimes can not be selected. Why? I do not know. It is my question. When folder does not exist I get log like this:

ChilkatLog:
  SelectMailbox:
    DllDate: Mar  6 2014
    ChilkatVersion: 9.5.0.16
    UnlockPrefix: TOPSYSIMAPMAILQ
    Username: KULIGIN:Kuligin
    Architecture: Little Endian; 32-bit
    Language: .NET 4.0
    VerboseLogging: 0
    mailbox: [Gmail]
    selectMailboxInner:
      mailboxPath: [Gmail]
      separatorChar: /
      Escaping quotes and backslashes in mailbox name...
      utf7EncodedMailboxPath: [Gmail]
      Failed to find OK line in response.
    --selectMailboxInner
    Failed to select/examine mailbox
    mailbox: [Gmail]
    imapSelectResponse: aaae NO [NONEXISTENT] Unknown Mailbox: [Gmail] (now in authenticated state) (Failure)
    Failed.
  --SelectMailbox
--ChilkatLog
link
This answer is marked "community wiki".

answered Apr 21 '14 at 03:24

kuligintim's gravatar image

kuligintim
316911

The problem is that some mailboxes may have the NoSelect flag set. The "[Gmail]" mailbox is one that always is non-selectable. See the contents of the Imap.SessionLog (which is kept if the Imap.KeepSessionLog = true:

----IMAP RESPONSE----
* LIST (\HasNoChildren) "/" "\"test\""
* LIST (\HasNoChildren) "/" "INBOX"
* LIST (\HasNoChildren) "/" "Trash"
* LIST (\Noselect \HasChildren) "/" "[Gmail]"
* LIST (\HasNoChildren \All) "/" "[Gmail]/All Mail"
* LIST (\HasNoChildren \Drafts) "/" "[Gmail]/Drafts"
* LIST (\HasNoChildren \Important) "/" "[Gmail]/Important"
* LIST (\HasNoChildren \Sent) "/" "[Gmail]/Sent Mail"
* LIST (\HasNoChildren \Junk) "/" "[Gmail]/Spam"
* LIST (\HasNoChildren \Flagged) "/" "[Gmail]/Starred"
* LIST (\HasNoChildren \Trash) "/" "[Gmail]/Trash"
* LIST (\HasNoChildren) "/" "[Gmail]/X&-Y"
* LIST (\HasNoChildren) "/" "[Gmail]/&APY-"
* LIST (\HasChildren) "/" "newFolder"
* LIST (\HasNoChildren) "/" "newFolder/Entw&APw-rfe"
aaac OK Success

Also, see the Chilkat.Mailboxes API ( http://www.chilkatsoft.com/refdoc/csMailboxesRef.html ). The Imap.ListMailboxes method returns an Imap.Mailboxes object. There are methods to get the value of any flag, and there are convenience methods for common flags, such as Mailboxes.IsSelectable().

link

answered Apr 21 '14 at 10:01

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

It's good, but... Are you sure that if mailbox has "Noselect" flag it can contains any mails or one mailbox can be selectable and unselectable in one session?

Log examples for previous errors list:

Mailaccount - testdocs@outlook.com Mailbox "Deleted" is selectable:

----IMAP REQUEST----
aaac LIST "" "*"
----IMAP RESPONSE----
* LIST (\HasNoChildren) "/" "Inbox"
* LIST (\HasNoChildren \Trash) "/" "Deleted"
* LIST (\HasNoChildren \Sent) "/" "Sent"
* LIST (\HasNoChildren \Drafts) "/" "Drafts"
* LIST (\HasNoChildren \Junk) "/" "Junk"
* LIST (\HasNoChildren) "/" "&BBAEQARFBDgEMg-"
* LIST (\HasNoChildren) "/" "&BDgENw- &BDQEPgQ6BEEEMA--111"
* LIST (\HasNoChildren) "/" "ffffffffff"
* LIST (\HasNoChildren) "/" "&BCMENAQwBDsENQQ9BD0ESwQ1-"
aaac OK LIST completed

Mail account - testdocs2014@yahoo.com
Mailbox "sent" is selectable:

----IMAP REQUEST----
aaac LIST "" "*"
----IMAP RESPONSE----
* LIST (\HasNoChildren) "/" "000000"
* LIST (\HasNoChildren) "/" "Bulk Mail"
* LIST (\HasNoChildren) "/" "Draft"
* LIST (\HasNoChildren) "/" "Inbox"
* LIST (\HasNoChildren) "/" "Nata 33333 550000000"
* LIST (\HasNoChildren) "/" "Sent"
* LIST (\HasNoChildren) "/" "Trash"
* LIST (\HasNoChildren) "/" "sozd v docs 111"
aaac OK LIST completed

For other mailboxes in previous list I have got the same results. All of them are selectable!

link

answered Apr 22 '14 at 08:45

kuligintim's gravatar image

kuligintim
316911

Please show the SessionLog that includes both listing the mailboxes AND a failed select.

link

answered Apr 22 '14 at 08:53

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Please download log files from Depositfiles:

http://dfiles.ru/files/nq0pazgjv

link

answered Apr 23 '14 at 04:32

kuligintim's gravatar image

kuligintim
316911

edited Apr 23 '14 at 07:21

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×175
×14

Asked: Apr 16 '14 at 10:24

Seen: 3,165 times

Last updated: Nov 01 at 08:51

powered by OSQA