Xojo Plugin
Xojo Plugin
Get a Mail-Merge Replace Pattern
See more Email Object Examples
Demonstrates the Chilkat Email.GetReplacePattern method, which returns a replacement pattern — the search string — previously defined for mail-merge operations with SetReplacePattern. The index is zero-based. This example defines two patterns and enumerates them.
Background: In Chilkat's mail-merge, each entry is a pattern (a placeholder token such as
FIRST_NAME) paired with a replacement string. GetReplacePattern retrieves the search side of the pair at a given index; GetReplaceString retrieves the matching replacement. Reading them back is useful for inspecting or logging exactly which substitutions will be applied when the message is sent.Chilkat Xojo Plugin Downloads
// Demonstrates the GetReplacePattern method, which returns a replacement pattern (the
// search string) previously defined for mail-merge operations with SetReplacePattern.
// The index is zero-based.
Dim email As New Chilkat.Email
email.Subject = "Hello FIRST_NAME"
email.Body = "Dear FIRST_NAME, welcome to CITY."
Dim success As Boolean
success = email.SetReplacePattern("FIRST_NAME","John")
success = email.SetReplacePattern("CITY","Denver")
Dim n As Int32
n = email.NumReplacePatterns
Dim i As Int32
For i = 0 To n - 1
System.DebugLog("Pattern " + Str(i) + ": " + email.GetReplacePattern(i))
Next