Tags & Macros
Tags
You can use tags anywhere in the message template body or header fields to indicate information to be merged in from a particular column in the mailing list. A tag looks like: |Name| where | is a tag indicator character (you can change the tag indicator character to anything you like in Preferences). Use two tag indicator characters in row if you want an actual tag indicator character to appear in the message. Tags are case-insensitive, so |name|, |Name|, and |NAME| are all treated the same. Your message template will generally contain a number of different tags such as:
Dear |Title| |LastName|: On |Date| you purchased...
CustomMailer uses this as an indication that the values in the mailing list columns labeled Title, LastName, and Date are to be substituted for those tags in the message for each selected recipient before their individualized message is sent, for example, messages for successive recipients might expand to:
Dear Mr. Jones: On 5/15/03 you purchased...
Dear Dr. Francis: On 3/23/01 you purchased...
Dear Ms. Taylor: On 10/12/02 you purchased...
etc.
Macros
Related to the notion of tags, you can also define a set of substitution rules called a "macro". Macros are a powerful way to create highly customized messages based on all the column data for each recipient in your mailing list. Macros are like "conditional tags", so that rather than simply substituting a mailing list column value directly, you can perform tests on any of the values in the given recipient's mailing list row to control the actual values to be merged into your message. For example, you might specify a macro called |WhichYear| with rules like:
IF |Date| ENDS WITH 2003 THEN Earlier this year
IF |Date| DOESN'T END WITH 2003 THEN Prior to this year
You create macros using the Macros dialog under the Settings menu. Each macro consists of one or more rules. Each rule is in the form:
IF operand1 operation operand2 THEN result
The value of operand1 is a tag representing any column of your mailing list and is selected from a popup menu in the Macros dialog.
The value of operation can be one of the following 17 values, also selected from a popup menu in the Macros dialog:
CONTAINS DOESN'T CONTAIN
EQUALS DOESN'T EQUAL
STARTS WITH DOESN'T START WITH
ENDS WITH DOESN'T END WITH
LENGTH = LENGTH < LENGTH >
DATE = DATE < DATE >
VALUE = VALUE < VALUE >
The first eight tests are string matching tests and (unlike the case for the Find and Select using Filters commands) are always case-sensitive. The next 3 LENGTH tests work on the length of the value as a string. The next 3 DATE tests work for dates given in most short and long standard formats (e.g. 8/15/00, August 15, 2000, etc.) and uses the internationalized dates, names, and formats appropriate for your country's locale as set in the Windows Control Panel "Regional Settings". If a DATE test encounters a value that isn't a date, it substitutes the date January 1, 1900 for the date. The last 3 VALUE tests work for either plain numbers (integers, such as 23 or -5, or non-integers, like 5.25) or the appropriate currency for your country's locale as set in the Windows Control Panel "Regional Settings". If a VALUE test encounters a value that isn't a number, it substitutes 0 for the value.
The value of operand2 can be any string not containing macros, but it can contain one or more tags, so that tag-to-tag comparisons are possible. For the LENGTH tests, operand2 should evaluate to an integer; and if not, it will be interpreted as 0.
The value of result can be any string, which itself may contain any number of tags or macros. Because it can contain macros, macros may be "nested" so one macro may turn into one or more other macros which may call still more macros and finally produce a result. As the following examples of possible result fields show, the result field might include no tags or macros, one tag or one macro, or multiple tags and/or macros as part of an overall string:
Thank you for your order which contains no tags or macros
On |Date| you purchased our software where |Date| is a tag
|WhichYear|, you visited our website where |WhichYear| is a macro
Dear |Title| |LastName|: where |Title| is a tag and |LastName| is a macro
When a macro is found in the message template, all of the rules of that macro are evaluated in order, so the last rule that evaluates as "true" will define the final result substituted into the message. All the macros in a message are evaluated in a first pass. These may expand into any combination of strings, tags, and possibly more macros. Any new macros thus generated are evaluated in second pass, which may introduce further macros. Multiple passes are used until no more macros remain.
It is an error if you define "circular macros", that is, macros that directly or indirectly generate copies of themselves, since they can never finish evaluating.. CustomMailer detects this condition and reports a "MACRO/TAG ERROR" and will not send the message.
»
|