Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Add In-Memory Data as Email Attachment How to add an email attachment directly from in-memory data. // Add in-memory data as an attachment to an email.
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");
CkEmail email;
email.put_Body("This is a test");
email.put_Subject("This is the subject.");
email.put_FromName("Bob");
email.put_FromAddress("bob@chilkatsoft.com");
email.AddTo("Chilkat Support","support@chilkatsoft.com");
const char *myText = "This will by my text file attachment\nEmail is easy!\n";
email.AddDataAttachment("MyText.txt",(const unsigned char *)myText,strlen(myText));
if (!mailman.SendEmail(&email))
{
// We could send the email in-process:
mailman.SaveLastError("errors.xml");
}
}
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.