Visual C++ Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
DH Key Exchange
DKIM/DomainKeys
Digital Certificates
Digital Signatures
DSA
Email
Email Object
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

 

 

Save Email to .eml File

Downloads:

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

Example source code to save emails to .EML files.

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

// Download and save emails to .eml files.
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;
	}

    // Set the POP3 port to the standard MS Exchange Server SSL POP3 port 995
    // mailman.put_MailPort(995);
    // Tell the mailman to connect to POP3 using SSL
    // mailman.put_PopSsl(true);

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

    // Copy email from the POP3 server.
    CkEmailBundle *bundle = 0;
    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);

	char fname[50];
	sprintf(fname,"email_%d.eml",i);

	// If you want to be able to edit the email in Outlook Express,
	// add the X-Unsent header:
	email->AddHeaderField("X-Unsent","1");

	email->SaveEml(fname);
	delete email;
	}

    delete bundle;

    return;
    }

 

 

 

© 2000-2013 Chilkat Software, Inc. All Rights Reserved.