Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Send Email with Progress MonitoringSend an email in C++ with progress monitoring.
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.