Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Send Identical Email to Distribution ListSends an identical email to a distribution list. 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 #include <C_CkMailMan.h> #include <C_CkEmail.h> #include <C_CkStringArray.h> void ChilkatSample(void) { HCkMailMan mailman; BOOL success; HCkEmail email; HCkStringArray sa; // The mailman object is used for sending and receiving email. mailman = CkMailMan_Create(); // Any string argument automatically begins the 30-day trial. success = CkMailMan_UnlockComponent(mailman,"30-day trial"); if (success != TRUE) { printf("Component unlock failed\n"); return; } // Set the SMTP server. CkMailMan_putSmtpHost(mailman,"mail.chilkatsoft.com"); CkMailMan_putSmtpUsername(mailman,"mySmtpLogin"); CkMailMan_putSmtpPassword(mailman,"****"); // Create a new email object email = CkEmail_Create(); CkEmail_putSubject(email,"This is a test"); CkEmail_putBody(email,"This is a test"); CkEmail_putFrom(email,"Chilkat Support <support@chilkatsoft.com>"); // Load a text file containing email addresses, one per line, // into a StringArray object. (In some programming languages, // this is a CkStringArray.) sa = CkStringArray_Create(); success = CkStringArray_LoadFromFile(sa,"distributionList.txt"); if (success != TRUE) { printf("Failed to load distributionList.txt\n"); return; } // Note: the distributionList.txt file contains one email // address per line. For example: // // matt@chilkatsoft.com // "Chilkat Admin" <admin@chilkatsoft.com> // <support@chilkatsoft.com> // // An email address may contain both the friendly name (in quote) // and the email address (in angled brackets). The friendly // name is optional. When the friendly name is missing, // angled brackets are optional. // If the SendIndividual property is TRUE, then the email // is sent individually to each recipient in the list using // the "To" header field. // If the SendIndividual property is FALSE, then emails // are sent in batches of 100 BCC's. Your program should // provide a single "To" address, such as: CkEmail_AddTo(email,"My List","listAdmin@chilkatsoft.com"); // This example will send emails individually, so we'll clear // the "To" list. CkEmail_ClearTo(email); // Set the mailman's SendIndividual property = TRUE CkMailMan_putSendIndividual(mailman,TRUE); success = CkMailMan_SendToDistributionList(mailman,email,sa); if (success != TRUE) { printf("%s\n",CkMailMan_lastErrorText(mailman)); } else { printf("Mail Sent!\n"); } CkMailMan_Dispose(mailman); CkEmail_Dispose(email); CkStringArray_Dispose(sa); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.