Sample code for 30+ languages & platforms
Delphi DLL

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 Delphi DLL Downloads

Delphi DLL
var
email: HCkEmail;

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

email := CkEmail_Create();
CkEmail_putSubject(email,'AppendToBody example');

//  Set an initial body.
CkEmail_SetTextBody(email,'First line.','text/plain');

//  Append more text to the existing body.
CkEmail_AppendToBody(email,' Appended text.');

Memo1.Lines.Add('Body = ' + CkEmail__body(email));

CkEmail_Dispose(email);