You can use tags anywhere in the message body or header fields to indicate information to be merged in from 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|:
DynamicMailer uses this as an indication that the values in the mailing list columns labeled Title and LastName 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:
Dear Dr. Francis:
Dear Ms. Taylor:
etc.
A tag can also be defined by a set of rules you can create called a
"macro". Macros are a powerful way to create highly customized messages
based on the data 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 the mailing list values to control the
actual values to be merged into your message. For example,
you might specify a macro for the tag |WhichYear| with rules like:
IF |Date| ENDS WITH 2000 THEN Earlier this year
IF |Date| DOESN'T END WITH 2000 THEN Prior to
this year
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.
The value of operation can be one of the following 11 values:
EQUALS
CONTAINS
STARTS WITH
ENDS WITH
LENGTH =
LENGTH < OR =
LENGTH > OR =
DOESN'T EQUAL
DOESN'T CONTAIN
DOESN'T START WITH
DOESN'T END WITH
The value of operand2 can be any string not containing tags or macros. For the LENGTH tests, operand2 should be an integer; and if not, it will be interpreted as 0.
The value of result can be any string containing any number
of tags representing either mailing list columns or macros. As the
following examples show, the result field might include no tags,
one tag, or multiple tags as part of an overall string:
Thank you for your order
On |Date| you purchased our software
Dear |Title| |LastName|:
When a macro is found in the message template, all of its rules are evaluated in order, so the last rule that evaluates as "true" will define the final result substituted into the message. All tags in a message which are macros 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 call themselves, since they can never finish expanding. DynamicMailer detects this condition and reports a "MACRO/TAG ERROR" and does not send the message.
After one or more passes succeed in expanding all the macros, a final pass is used to expand any remaining tags using mailing list column values. Having |Name| as both a macro and a mailing list column will never access the mailing list column called Name since either |Name| goes away during the macro expansion passes or it will be detected as a circular macro.
NOTE: To catch errors caused by unexpected data values, each macro used in the message must have at least one rule that evaluates as "true". If a recipient has data values for which any given macro has all rules "false" , you get a "MACRO/TAG ERROR" for this recipient and the message won't be sent. This feature permits a form of error checking on the data fields in your mailing list simply by making sure all rules evaluate to "false" for illegal values.
All tag names, whether used as macros or mailing list column headings,
are case-insensitive, so |Name|,
|name|, and |NAME|
are all treated the same. However, all of the string tests within
the macro rules are case-sensitive, so you should use separate rules
if you want to test different cases, e.g.
IF |Date| CONTAINS Feb THEN February
IF |Date| CONTAINS feb THEN February
The strings in the result field are used with their case preserved.
An interactive Macros dialog is provided for creating and editing your
macros. Your current set of macros are automatically remembered across
runs of DynamicMailer. Most customers think of macros as a set of
standard rules and message parts they build up and reuse across all messages
they compose. Macros may also be written to or read from an external
file. This allows different sets of macros to be swapped in and out
if that is desired. The macros will be written as a tab-delimited
plain text file with one rule per line using the macro name in the first
column. This makes the macros file suitable for use in a spreadsheet
program such as Microsoft Excel, which can further assist creation and
editing of macro rules.
The following examples illustrate possible uses of macros. Note that DynamicMailer ships with a set of predefined macros which you may find useful as they are or as a starting point for creating your own macros.
Substitute for keywords or abbreviations
Rules for macro |BrowserName|:
IF |Browser| CONTAINS Mozilla THEN Netscape
Communicator
IF |Browser| CONTAINS MSIE THEN Microsoft Internet
Explorer
Usage: Your browser is |BrowserName|
The above macro has the following results:
If the "Browser" column
contains "Mozilla": Your browser is Netscape Communicator
If the "Browser" column
contains "MSIE": Your browser is Microsoft Internet Explorer
Rules like these can substitute real words for abbreviations and codes
you may have in your mailing list.
Test for missing data
Rules for macro |Salutation|:
IF |First| LENGTH < OR = 1 THEN Dear customer,
IF |First| LENGTH > OR = 2 THEN Dear |First|,
Usage (as the first line in a message): |Salutation|
This takes care of the case where a customer enters only an initial or nothing for their first name.
Don't send mail if missing data
Rule for macro |Salutation|:
IF |First| LENGTH > OR = 2 THEN Dear |First|,
Usage (in a greeting): |Salutation|
This is almost the same as the previous example except that there is no rule for LENGTH < OR = 1. In this case, if a customer entered only an initial or nothing for their first name, the absence of a rule will generate a MACRO/TAG ERROR for this recipient, resulting in the message not being sent to them.
Use of default values
Rules for macro |TheYearInWhichYou|:
IF |Date| STARTS WITH THEN It has been a long
time since you
IF |Date| ENDS WITH 99 THEN It was some time
last year that you
IF |Date| ENDS WITH 00 THEN Earlier this year
you
IF |Date| LENGTH = 0 THEN This is the first
time you have
Usage: |TheYearInWhichYou| visited us.
The first rule, a test for STARTS WITH where an empty string is the
second operand, is always true. Rules are evaluated in order so the
last rule that is true will determine the final result. So, this
first rule provides a default answer if no subsequent rule evaluates to "true".
Other rules that always evaluate to "true" are END WITH empty string,
CONTAINS empty string, and LENGTH > OR = 0. The above
macro has the following results:
Date missing:
This is the first time you have visited us.
Date ends in 00:
Earlier this year you visited us.
Date ends in 99:
It was some time last year that you visited us.
Any other year:
It has been a long time since you visited us.
Using address to control whether to send message
Rules for macro |EmailAddressing|:
IF |Email| STARTS WITH THEN |First| |Last| <|Email|>
IF |First| LENGTH = 0 THEN |Title| |Last| <|Email|>
IF |Last| LENGTH = 0 THEN |Email|
IF |Date| DOESN'T END WITH 00 THEN Don't send
Usage (in the TO: field): |EmailAddressing|
The last rule says that if the date wasn't this year, use the email
address "Don't send". Recall that when the address is not
of the form name@domain.type, DynamicMailer generates a "MESSAGE
ERROR" and automatically doesn't send the email message. Thus, macro
rules provide another way to select whether or not to send messages to
particular recipients. This macro has the following results:
Date doesn't end with
00:
MESSAGE ERROR, message not sent
Last name missing:
send message to: rjones@company.com
First but not last
name missing: send message to
Mr. Jones <rjones@company.com>
First and last names
given:
send message to: Robert Jones <rjones@company.com>
DynamicMailer by Sohoany Inc.