Let’s say you send out a daily email, and you want to automatically include that day’s date in the email template. To do this, you will use tokens and email scripting in Marketo.
Step One: Create a token.
Navigate to the program where you want to use the token. Click My Tokens.
Double click on Email Script. Then name this token. Then click Edit.
Paste the email script below in this window. Then click Save.
## Access Velocity's calendar object
#set($x = $date.calendar)
## Format date
#set($current_date = $date.format('dd-MM-yyyy', $x.getTime()))
## Returns today's date
Step Two: Reference the token in the email template.
Note the name of the token.
Navigate to your email draft. Include the token.
When the email is sent out, the value of the token will be populated. For more information, please see the Email Scripting developer documentation.