#include
void ChilkatSample(void)
{
HCkMailMan mailman;
BOOL success;
HCkEmail email;
// 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");
// You may or may not need SMTP authentication -- it depends
// on your SMTP server...
CkMailMan_putSmtpUsername(mailman,"mylogin");
CkMailMan_putSmtpPassword(mailman,"mypassword");
// Create a new email object
email = CkEmail_Create();
// Note: .mht files are MIME, and are really no different
// than .eml. The only difference is the file extension
// and the intended use. You can load any .mht into
// an email object by calling LoadEml:
success = CkEmail_LoadEml(email,"myMhtml.mht");
if (success != TRUE) {
printf("%s\n",CkEmail_lastErrorText(email));
return;
}
// To complete the email, add a subject, From address,
// and recipients...
CkEmail_putSubject(email,"This is an MHTML email test");
CkEmail_putFrom(email,"Chilkat
CkEmail_AddTo(email,"Chilkat Support","support@chilkatsoft.com");
// Send the MHTML mail.
success = CkMailMan_SendEmail(mailman,email);
if (success != TRUE) {
printf("%s\n",CkMailMan_lastErrorText(mailman));
}
else {
printf("Mail Sent!\n");
}
CkMailMan_Dispose(mailman);
CkEmail_Dispose(email);
}
0 comments:
Post a Comment