This isn't a Velocity post, and yet it is

Update 2017-04-13: I misdiagnosed the cause of this issue originally (though my fix still worked) which was stupid because I'm supposed to be Mr. Velocity.

You should already know that variables don't work in the Text version of Marketo emails. And you've likely dismissed this as a head-shakingly short-sighted mostly harmless detail.

But it has one wider consequence, as user JK noticed in this Community thread, that's firmly a bug — and one which impacts the email as a whole.

The documented (if suboptimal) behavior

Variables on the Text side are typically replaced with blank output. This can either:

(a) mangle the Text version, if variables happen to contain critical content, or
(b) be fine and dandy, if variables hold colors or other styles that pertain only to the HTML side anyway

Outcome (a) is not great, but at least you know to plan for it.

The undocumented (and bad) behavior

But when a mktoString is used as a link, like…

<a href="${link}">Click for fun in the sun</a>

and uses one of the 20 or so Velocity reserved words, ya got problems. Because of the additional layer of processing for links (to be rewritten to the branding/tracking domain) you get everybody's favorite WTF:

And this happens regardless of whether you used any Velocity tokens!

(Of course I mean any userland {{my.tokens}} because Velocity is always used to assemble Marketo emails, even if you don't write any code yourself. Didja know that? Or maybe suspect it?)

Anyway, the solution is to not use any of these words as ${variable} names (and tell your template designer, too):

alternator
class
content
context
convert
cookies
date
display
esc
field
import
include
link
loop
math
mktEncrypt
my
number
pager
params
render
sorter
text
xml
GENERIC_TOOLS_AVAILABLE
STRUTS_TOOLS_AVAILABLE
TOOLS_VERSION
VIEW_TOOLS_AVAILABLE

And that's about all I have to say about that.