Visual C++ Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# WinRTDelphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET WinRTVBScript

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

 

 

 

 

 

 

 

 

Simple Example to Send Email

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

This is a simple example showing how to send email in C++.

#define _CRTDBG_MAP_ALLOC
#include <windows.h>
#include <stdio.h>
#include <crtdbg.h>

#include "CkSettings.h"
#include "CkEmail.h"
#include "CkEmailBundle.h"
#include "CkMailMan.h"
#include "CkString.h"
#include "CkByteData.h"

void EmailExample(void)
    {
    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_SmtpHost("mail.earthlink.net");
    
    // Create the email, add the body, recipients, subject, etc.
    CkEmail email;
    email.put_Body("This is a test\r\nThis is line #2");

    email.AddTo("Chilkat Support","support@chilkatsoft.com");
    
    email.put_FromAddress("somebody@chilkatsoft.com");

    email.put_Subject("This is a test");

    // Send the email
    if (!mailman.SendEmail(&email))
	{
	mailman.SaveLastError("errors.xml");
	}

    }

int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
    freopen("stdout.txt","w",stdout);

    EmailExample();

    CkSettings::cleanupMemory();

    _CrtDumpMemoryLeaks();

    return 0;
}



 

 

 

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