Using an email script token in the subject line

Phillip_Wild
Level 10 - Community Advisor

Using an email script token in the subject line

Tricky one here. I've used an email token to spit out a variable in an email program. But in Apple Mail and Outlook 2014 there are weird spaces inserted before and after the token. See below.

Email Script Issue.jpg

The token is £100 GBP. The random spaces are definitely not part of the code.

Weird things I found out:

* When I simply put the plain text of "£100 GBP" as the output of the email script, the weird spaces remain. So it's nothing to do with my code.

* When I use a Plain Text token instead of an Email Script token (effectively making the token static), it works fine.

This might be something purely in Apple Mail and Outlook (it looks fine in Outlook365.com, interestingly enough), but in any case I can't risk it. I had to use an alternative subject line instead of something dynamic.

Has anyone encountered this before? I've asked Support but basically since it's to do with email rendering they have said they can't help me.

Phil

Tags (1)
3 REPLIES 3
Scott_McKeighe2
Level 5

Re: Using an email script token in the subject line

Did you try making the entire string part of your Email Script token, not just the £100 GBP ? I'd try that to see if it alleviates the rendering issue.

Phillip_Wild
Level 10 - Community Advisor

Re: Using an email script token in the subject line

Weirdly, that's giving me a different error. Every variant has a currency in it (either a dollar, pound or euro sign) and when I put the entire string in the email script output, then put only the token in the subject line, then it either:

1. Shows "£100" if the string was meant to be "(string) £100 GBP (string)"

2. Shows "100" if the string was meant to be "(string) $100 (string)"

I think this is because Velocity is interpreting the string as purely the variable name. For example, I'm using lines such as:

#set ($LifetimeDepositFormatted = "Don't forget your £100 GBP Lifetime Deposit!") or

#set ($LifetimeDepositFormatted = "Don't forget your $250 NZD Lifetime Deposit!")

This might be interacting with the subject line in strange ways.

Edward_Unthank_
Level 10

Re: Using an email script token in the subject line

Innnnnnteresting. I don't know why, but here could be some guesses for troubleshooting and finding the problem.

Can you count the number of spaces? Could be the scripting token is counting whitespace and rendering it in the subject line. Aka something like "echo '$100';" might count an extra whitespace.

Do you have the same problem if you just output the response (no code in the email script) with just "100" and not the special character?

Edward