Sample code for 30+ languages & platforms
PowerBuilder

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 PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Email

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

loo_Email = create oleobject
li_rc = loo_Email.ConnectToNewObject("Chilkat.Email")
if li_rc < 0 then
    destroy loo_Email
    MessageBox("Error","Connecting to COM object failed")
    return
end if
loo_Email.Subject = "AppendToBody example"

//  Set an initial body.
loo_Email.SetTextBody("First line.","text/plain")

//  Append more text to the existing body.
loo_Email.AppendToBody(" Appended text.")

Write-Debug "Body = " + loo_Email.Body


destroy loo_Email