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

 

 

 

 

 

 

 

 

Read Mail from POP3 Leaving it on the Server

Download Chilkat C/C++ Libraries for VC++ 9.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 8.0 / Win32

Download Chilkat C/C++ 64-bit Libraries for VC++ 8.0 / x64

Download Chilkat Visual Studio 2005 C/C++ Libs for Windows Mobile, Pocket PC, SmartPhone, WinCE

Download Chilkat C/C++ Libraries for VC++ 7.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0, Win 95/98/NT4 Compatible

Demonstrates how to read email from a POP3 server, leaving it on the server.

// The Chilkat Mail library is also available as an ActiveX component
// or .NET class with the identical set of methods and properties.

// Read POP3 email, leaving it on the server.
void EmailExample(void)
    {
    CkString str;
    CkMailMan mailman;

    // Any string passed to UnlockComponent begins the 30-day trial.
    bool unlocked = mailman.UnlockComponent("30-day trial");
    if (!unlocked)
	{
	printf("Failed to unlock component\n");
	return;
	}

    mailman.put_MailHost("mail.chilkatsoft.com");
    mailman.put_PopUsername("matt");
    mailman.put_PopPassword(myPassword);

    CkEmailBundle *bundle = 0;

    // Copy email from the POP3 server, leaving it on the server.
    bundle = mailman.CopyMail();
    if (!bundle)
	{
	mailman.LastErrorText(str);
	printf("%s",str.getString());
	return;
	}

    int i;
    int n = bundle->get_MessageCount();

    for (i=0; i<n; i++)
	{
	CkEmail *email = bundle->GetEmail(i);

	email->get_Subject(str);
	printf("Subject: %s\n",str.getString());

	email->get_From(str);
	printf("From: %s\n",str.getString());

	// Gets the default body.  If multipart/alternative where both
	// HTML and plain-text bodies are present, the HTML body is retrieved.
	email->get_Body(str);
	printf("Body -----------\n%s\n---------------\n",str.getString());

	delete email;
	}

    delete bundle;

    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