Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
IMAP Mailbox Hierarchy Separator Character 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;
}
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.