Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
IMAP Sub-Folders and MailboxesHow to select an IMAP sub-folder. Dim fso, outFile Set fso = CreateObject("Scripting.FileSystemObject") Set outFile = fso.CreateTextFile("output.txt", True) set imap = CreateObject("Chilkat.Imap") ' Anything unlocks the component and begins a fully-functional 30-day trial. success = imap.UnlockComponent("Anything for 30-day trial") If (success <> 1) Then MsgBox imap.LastErrorText WScript.Quit End If ' Connect to an IMAP server. success = imap.Connect("mail.chilkatsoft.com") If (success <> 1) Then MsgBox imap.LastErrorText WScript.Quit End If ' Login success = imap.Login("admin@chilkatsoft.com","****") If (success <> 1) Then MsgBox imap.LastErrorText WScript.Quit End If ' The default value of the mailbox hierarchy separator char ' is a period '.' char. MsgBox "Separator Char: " & imap.SeparatorChar ' If you know your IMAP server's separator char, you may ' explicitly set it. For example: imap.SeparatorChar = "/" MsgBox "Separator Char: " & imap.SeparatorChar ' 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.) Set mboxes = imap.ListMailboxes("","*") MsgBox "Separator Char: " & imap.SeparatorChar ' 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.SeparatorChar folderPath = "Inbox" & s & "oldEmail" success = imap.SelectMailbox(folderPath) If (success <> 1) Then MsgBox imap.LastErrorText WScript.Quit End If outFile.WriteLine("Number of messages in " & folderPath & ": " & imap.NumMessages) outFile.Close |
Need a specific example? Send a request to support@chilkatsoft.com
© 2003-2007 Chilkat Software, Inc. All Rights Reserved.