Sample code for 30+ languages & platforms
Unicode C

Append Text to an Email Body

See more Email Object Examples

Demonstrates the Chilkat Email.AppendToBody method, which appends additional text to the email's existing plain-text body rather than replacing it. This example sets an initial body and then appends more text.

Background: Setting the body (via Body or SetTextBody) replaces whatever was there, while AppendToBody adds to it. That is convenient when a message body is assembled in pieces — for example a greeting, then dynamically generated lines, then a signature — without having to concatenate the whole string yourself before assigning it.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkEmailW.h>

void ChilkatSample(void)
    {
    HCkEmailW email;

    //  Demonstrates the AppendToBody method, which appends additional text to the email's
    //  existing plain-text body.

    email = CkEmailW_Create();
    CkEmailW_putSubject(email,L"AppendToBody example");

    //  Set an initial body.
    CkEmailW_SetTextBody(email,L"First line.",L"text/plain");

    //  Append more text to the existing body.
    CkEmailW_AppendToBody(email,L" Appended text.");

    wprintf(L"Body = %s\n",CkEmailW_body(email));


    CkEmailW_Dispose(email);

    }