+1 vote

When connecting to outlook via ssl, the getfolders function seems to be removing a left square bracket from the folder name, but only if it is the last letter.

For example: FolderName[

However, the following folder names are just fine:

Folder[]
[Folder]
Folder]
Folder[][ (this one surprisingly comes back correctly)

What is weirder is that a folder named: 'Folder[Name', will return as 'Folder'. It seems to have stripped everything after the bracket.

I can't seem to nail down the behavior of when characters will get stripped from the folder name, but the above examples are consistent. Any thoughts on what is going on? I believe I'm using version 3.0

by (250 points)
Can you please turn on logging:
https://www.limilabs.com/blog/logging-in-mail-dll

Does this happen with the latest version?
Here is the output after logging is enabled. The folder names do indeed look correct. However the values in FolderInfo do not match what is in the logs.

Mail.dll Information: 0 :  1 09:34:43 C: c10434f68c9244da LIST "" ""
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\Noselect \HasChildren) "/" ""
Mail.dll Information: 0 :  1 09:34:43 S: c10434f68c9244da OK LIST completed.
Mail.dll Information: 0 :  1 09:34:43 C: 4710d50f769747c3 LIST "" "*"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" Archive
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasChildren) "/" Calendar
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" Calendar/Birthdays
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "Calendar/United States holidays"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasChildren) "/" Contacts
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasChildren) "/" "Conversation History"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasChildren \Trash) "/" "Deleted Items"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren \Drafts) "/" Drafts
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\Marked \HasChildren) "/" INBOX
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" INBOX/!Excla!mation!
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "INBOX/[Brac[]kets]"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" INBOX/Brackets[
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "INBOX/Brackets2[]["
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "INBOX/Brackets2[]]"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "INBOX/BracketsEnd[]"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasChildren) "/" INBOX/BRACKETTEST[
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "INBOX/BRACKETTEST[/brackettest child"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" {13}
Mail.dll Information: 0 :  1 09:34:43 S (13 bytes): INBOX/BSlash\
Mail.dll Information: 0 :  1 09:34:43 S:
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" INBOX/Strange[Folder
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" INBOX/Weird[Man[
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" Journal
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren \Junk) "/" "Junk Email"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" Notes
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" Outbox
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "RSS Subscriptions"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren \Sent) "/" "Sent Items"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasChildren) "/" "Sync Issues"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "Sync Issues/Conflicts"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "Sync Issues/Local Failures"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" "Sync Issues/Server Failures"
Mail.dll Information: 0 :  1 09:34:43 S: * LIST (\HasNoChildren) "/" Tasks
Mail.dll Information: 0 :  1 09:34:43 S: 4710d50f769747c3 OK LIST completed.
I also tried it with the latest dll and the results are the same.
Thanks for the logs, will forward to development team.

Which names exactly are different?
Here is a screenshot with 2 examples that illustrate the issue.

https://i.imgur.com/DToWXKz.png
Dev team will investigate by the end of the next week.
Most likely the problem is with missing quotes around some of the names. '[' is treated as a special char in such case. At this point I'm still not sure if the bug is on client or server side. Nevertheless we'll try to improve.

I need to ask for one more favor: can you please copy and paste the very start of the log - everything until a login sequence.

We're particularly interested in the server greeting.
Mail.dll Information: 0 :  1 10:28:05 3.0.18151.1319
Mail.dll Information: 0 :  1 10:28:05 Checking if license file is present.
Mail.dll Information: 0 :  1 10:28:05 License file present. Loading license file.
Mail.dll Information: 0 :  1 10:28:05 License file loaded. Loading xml.
Mail.dll Information: 0 :  1 10:28:05 Xml loaded. Getting public key.
Mail.dll Information: 0 :  1 10:28:05 Public key acquired. Checking if license signature is valid.
Mail.dll Information: 0 :  1 10:28:05 Signature valid. Checking if license xml file is valid.
Mail.dll Information: 0 :  1 10:28:05 License xml file is valid. Checking if license is valid.
Mail.dll Information: 0 :  1 10:28:05 Connecting to 'outlook.office365.com:993', SSL: True.
Mail.dll Information: 0 :  1 10:28:05 S: * OK The Microsoft Exchange IMAP4 service is ready. [QwBZADQAUABSADEAOAAwADEAQwBBADAAMAAzADYALgBuAGEAbQBwAHIAZAAxADgALgBwAHIAbwBkAC4AbwB1AHQAbABvAG8AawAuAGMAbwBtAA==]
Mail.dll Information: 0 :  1 10:28:05 C: 05560000 CAPABILITY
Mail.dll Information: 0 :  1 10:28:05 S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
Mail.dll Information: 0 :  1 10:28:05 S: 05560000 OK CAPABILITY completed.
Mail.dll Information: 0 :  1 10:28:05 C: 05560001 ID ("name" "Mail.dll - Trial (please purchase a license at https://www.limilabs.com/mail )" "version" "3.0.18151.1319" "vendor" "www.limilabs.com" "contact" "support@limilabs.com")
Mail.dll Information: 0 :  1 10:28:05 S: * ID ("name" "Microsoft.Exchange.Imap4.Imap4Server" "version" "15.20")
Mail.dll Information: 0 :  1 10:28:05 S: 05560001 OK ID completed
Mail.dll Information: 0 :  1 10:28:05 C: 05560002 AUTHENTICATE PLAIN
Mail.dll Information: 0 :  1 10:28:05 S: 05560002 OK AUTHENTICATE completed.
Mail.dll Information: 0 :  1 10:28:05 C: 05560003 CAPABILITY
Mail.dll Information: 0 :  1 10:28:06 S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION BACKENDAUTHENTICATE CHILDREN IDLE NAMESPACE LITERAL+
Mail.dll Information: 0 :  1 10:28:06 S: 05560003 OK CAPABILITY completed.
Mail.dll Information: 0 :  1 10:28:06 C: 05560004 LIST "" ""
...
I am under a time crunch and was wondering if this would be a suitable workaround for getting folder names:

var response = imap.SendCommand("LIST \"\" \"*\"");

then looping through response.Lines, and extracting the folder name from that string. Any thoughts?
Another option that is more comprehensive, but performs poorly, is to call

imap.Examine("folder")

on all the folders returned by imap.GetFolders(). If an exception is thrown, then I know that is a bad folder name, (which for my purposes will suffice) and I can filter it out.

Is there a more performant way to do a check like this?
Parsing IMAP responses is complicated.

If you have one specific sever to deal with, you may be able to do this, we don't recommend this however.

I can't think of any faster way.
Thank you for detailed bug report.

Fixed in the latest version (3.0.18165.2350).
Awesome, thanks for the quick turnaround.

1 Answer

0 votes

Thank you for detailed bug report.

Fixed in the latest version (3.0.18165.2350).

by (297k points)
...