Archived Forum Post

Index of archived forum posts

Question:

Mailbox separator for IBM Lotus Notes

Mar 24 '17 at 06:35

I have an issue with getting list of mailboxes from IBM Lotus Notes 9.0.

Lotus Notes uses "" char as separator to separate parent/child folders(mailboxes doesn't matter).

Session log: ----INFO---- Connecting to IMAP server at %IP-ADDRESS%:143 ----IMAP RESPONSE---- * OK Domino IMAP4 Server Release 9.0 ready Thu, 23 Mar 2017 21:54:35 +0400 ----IMAP REQUEST---- aaab LOGIN "%USERNAME%" ----IMAP RESPONSE---- aaab OK LOGIN completed ----IMAP REQUEST---- aaac LIST "" "*" ----IMAP RESPONSE---- * LIST (Noinferiors HasNoChildren) "\" Inbox * LIST (Noinferiors HasNoChildren) "\" Trash * LIST (HasChildren) "\" Untitled * LIST (HasNoChildren) "\" "Untitled 2" * LIST (HasChildren) "\" {18} UntitledUntit_led * LIST (HasNoChildren) "\" {29} UntitledUntit_ledUntitled55 * LIST (HasNoChildren) "\" zzz_xxx aaac OK LIST completed

LastErrorText: ChilkatLog: ListMailboxes: DllDate: Mar 20 2017 ChilkatVersion: 9.5.0.66 UnlockPrefix: 7PGRPCIMAPMAILQ Architecture: Little Endian; 32-bit Language: .NET 4.5 VerboseLogging: 0 listMailboxes: bSubscribedOnly: 0 reference: mailbox: Escaping quotes and backslashes in mailbox name... utf7EncodedMailboxPath: isOK: serverResponse: aaac OK LIST completed --isOK Success. --listMailboxes Success. --ListMailboxes --ChilkatLog

Mailboxes.GetName(index) for Untitled\Untit_led mailbox returns "UntitledUntit_led" without separator char. It makes impossible to know the real name and path for folder. Furthermore it makes impossible to select such mailbox - because i don't know full name.

Setting up the SeparatorChar to "\" also didn't helped.

The question is are there any way to get correct names?


Answer

The imap.ListMailboxes method has the side-effect of setting the value of the imap.SeparatorChar property to the correct value for that particular mail server. To find the correct SeparatorChar, call SelectMailboxes, and then see what it is..


Answer

Hi,

There is not SelectMailboxes method in .Net IMAP component. At same time SelectMailbox doesn't set correct separator. ListMailboxes also doesn't do that.

SeparatorChar equals to period "." all the time - before/after SelectMailbox method and before/after ListMailboxes method.

Actually raw response for ListMailboxes contains correct mailbox name/path, but when i'm trying to iterate through received mailboxes i'm getting names/paths without separator.


Raw request/response for ListMailboxes:

----IMAP REQUEST----

aaac LIST "" "*"

----IMAP RESPONSE----

* LIST (\Noinferiors \HasNoChildren) "\\" Inbox

* LIST (\Noinferiors \HasNoChildren) "\\" Trash

* LIST (\HasChildren) "\\" Untitled

* LIST (\HasNoChildren) "\\" "Untitled 2"

* LIST (\HasChildren) "\\" {13}

Untitled\test

* LIST (\HasNoChildren) "\\" {23}

Untitled\test\testInner

* LIST (\HasNoChildren) "\\" zzz_xxx

aaac OK LIST completed


As you can see raw response contains mailboxes Untitled\test and Untitled\test\testInner. But when i'm iterating through retrieved mailboxes and asking for names(mailboxes.GetName(i)) i get Untitledtest and UntitledtesttestInner.


LastErrorText also says that there was an error in escaping backslashes: Escaping quotes and backslashes in mailbox name...

full LastError text exists in prev. message.

Main question is how can i get correct mailboxes names?