Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

August 6, 2007

IMAP Mailbox (sub-folder) Hierarchy Separator Character

IMAP servers may differ in the separator character used in mailbox folder hierarchy paths. Common separator chars are ‘.’ and ‘/’. For example:

Inbox.Vendors.Chilkat

or

Inbox/Vendors/Chilkat

Chilkat IMAP methods that require a folder path in any argument must use the correct separator character. The default separator char is ‘.’.

The Chilkat.Imap.SeparatorChar property can be set to specify the separator character. If you need to programmatically determine the SeparatorChar at runtime, you can call Chilkat.Imap.ListMailboxes because the IMAP server includes the separator character in a LIST response. The SeparatorChar property is automatically set as a side-effect of calling ListMailboxes.

Sample Ruby code (from https://www.example-code.com/ruby/imap_subFolder.asp ):

...
#  The default value of the mailbox hierarchy separator char
#  is a period '.' char.
print "Separator Char: " + imap.get_SeparatorChar() + "\n"
	
#  If you know your IMAP server's separator char, you may
#  explicitly set it.  For example:
imap.put_SeparatorChar("/")
print "Separator Char: " + imap.get_SeparatorChar() + "\n"
	
#  If you don't know the value of the separator char, the
#  Chilkat IMAP component sets it automatically during
#  a ListMailboxes call.  (The reason is that the IMAP separator
#  char is specified in the IMAP list mailboxes response.)
	
mboxes = imap.ListMailboxes("","*")
	
print "Separator Char: " + imap.get_SeparatorChar() + "\n"
	
#  To select a sub-folder, start with the top-level mailbox
#  and build a path using the separator char.  The top-level
#  mailbox should be named "Inbox":
	
s = imap.get_SeparatorChar()
folderPath = "Inbox" + s + "oldEmail"
	
success = imap.SelectMailbox(folderPath)
if (success != true)
    print imap.lastErrorText() + "\n"
    exit
end
	
print "Number of messages in " + folderPath + ": " + imap.get_NumMessages().to_s() + "\n";


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.