Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



Visual C++ Examples

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


More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
FileAccess
Bzip2
LZW
Icon

 

 

 

 

 

 

 

 

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.

Mail Component · .NET Mail Component · XML Parser