Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual C++ Examples

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


More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

 

Send Email with Progress Monitoring

Send an email in C++ with progress monitoring.

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

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

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

void ChilkatSample(void)
    {
    //  
// To receive progress callbacks, create a class that
// inherits CkMailProgress and overrides the SendPercentDone,
// ReadPercentDone, and AbortCheck callbacks.
class MyMailProgress : public CkMailProgress
    {
    public:
	MyMailProgress(void) { }
	virtual ~MyMailProgress(void) { }

	// The PercentDone callbacks are called when
	// the percentage completion increases.  The Chilkat
	// lib will not make callbacks faster than (approx)
	// once every .1 or .2 seconds.  Therefore, if the
	// email is not large, the pctDone may increase by
	// more than 1% for each call.
	void SendPercentDone(long pctDone, bool *abort) 
	    { 
	    printf("SendPercentDone: %d percent\n",pctDone);
	    }
	void ReadPercentDone(long pctDone, bool *abort) 
	    { 
	    printf("ReadPercentDone: %d percent\n",pctDone);
	    }
	void AbortCheck(bool *abort) 
	    { 
	    printf("AbortCheck!\n");
	    }
    };

void TestGmailSendWithProgress(void)
    {
    CkMailMan mailman;
    mailman.UnlockComponent("test");

    mailman.put_SmtpHost("smtp.gmail.com");
    mailman.put_SmtpPort(465);
    mailman.put_SmtpSsl(true);

    mailman.put_SmtpUsername("****@gmail.com");
    mailman.put_SmtpPassword("****");

    CkEmail email;
    email.put_Body("This is a test");
    email.put_Subject("this is a test");
    email.put_From("chilkat.support@gmail.com");
    email.AddTo("Chilkat Support","support@chilkatsoft.com");

    // Instantiate a callback object, and set the progress callback:
    MyMailProgress mailCallback;
    mailman.SetProgressCallback(&mailCallback);

    // Send the email with progress callbacks.
    bool b = mailman.SendEmail(email);
    if (!b)
	{
	mailman.SaveLastError("sendErrors.txt");
	}
    else
	{
	printf("Mail sent!\n");
	}

    }

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