Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
IMAP Mailbox Hierarchy Separator CharacterDownloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries FreeBSD C++ Libraries HP-UX C++ Libraries BlackBerry QNX C++ Libraries C++ example code to list IMAP mailboxes and determine the mailbox hierarchy separator character. // List mailboxes and determine the separator character used for
// the mailbox hierarchy.
void TestImapListMailboxes(void)
{
CkImap imap;
// Any string passed to UnlockComponent automatically begins the 30-day trial.
if (!imap.UnlockComponent("30-day trial"))
{
imap.SaveLastError("errorLog.xml");
return;
}
// Connect to the IMAP server.
if (!imap.Connect("mail.chilkatsoft.com"))
{
printf("Failed to connect to IMAP server\n");
imap.SaveLastError("errorLog.xml");
return;
}
// Login to the IMAP server.
if (!imap.Login("matt@chilkatsoft.com","***"))
{
printf("Failed to login to IMAP server\n");
imap.SaveLastError("errorLog.xml");
return;
}
// The mailbox separator character will become known
// after listing the mailboxes.
CkMailboxes *mboxes = imap.ListMailboxes("","*");
if (!mboxes)
{
printf("Failed to login to list mailboxes\n");
imap.SaveLastError("errorLog.xml");
return;
}
// Print the last response received from the IMAP server.
CkString strLastResponse;
imap.LastResponse(strLastResponse);
printf("Raw IMAP response received from List mailboxes command:\n");
printf("%s\n",strLastResponse.getAnsi());
// Print the mailbox names.
CkString strName;
int i;
int n = mboxes->get_Count();
for (i=0; i<n; i++)
{
mboxes->GetName(i,strName);
printf("%s\n",strName.getString());
}
delete mboxes;
// Print the mailbox separator character.
printf("Separator: %c\n",imap.get_SeparatorChar());
return;
}
|
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.