To configure the Email adapter in List mode using the Velocity template:
1. In the Message Body tab of the Email Adapter Configurator dialog box, write the message.
For Example:
Hello $ (Name),
You just won the following:
#foreach ($(p)in $ (PRIZES))
- $(p)
#end
Please, call $(PHONE) to claim your prize.
In the above example, ${NAME} will be substituted with the winner's name.
The foreach loop will be expanded to a list of the prizes won. For this to happen, the ${PRIZES} variable must contain the List of prizes won by the given person.
The ${PHONE} variable is replaced with the phone number to call, which is the same for all messages sent.
Finally, ${P} is an internal variable used in the loop that should not be mapped to a dataslot.
2. Click the Extract Variables button to list all four variables, NAME, P, PRIZES, and PHONE. As mentioned, P is an internal variable, so you can remove it from the list.
3. Complete the rest of the adapter configuration, leaving the "To:" field in the Message tab empty (so it will be mappable to dataslot) and close the Email Adapter Configurator dialog window.