DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoEmail
String sTemp1
// Demonstrates the AppendToBody method, which appends additional text to the email's
// existing plain-text body.
Get Create (RefClass(cComChilkatEmail)) To hoEmail
If (Not(IsComObjectCreated(hoEmail))) Begin
Send CreateComObject of hoEmail
End
Set ComSubject Of hoEmail To "AppendToBody example"
// Set an initial body.
Send ComSetTextBody To hoEmail "First line." "text/plain"
// Append more text to the existing body.
Send ComAppendToBody To hoEmail " Appended text."
Get ComBody Of hoEmail To sTemp1
Showln "Body = " sTemp1
End_Procedure