Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Visual C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
RSA
S/MIME
Socket
Spider
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
FileAccess
Bzip2
LZW
Icon

 

 

 

 

 

 

 

 

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.

Mail Component · .NET Mail Component · XML Parser