Email Script token using in Email From field? | Community
Skip to main content
Kacper_Gawlik1
New Participant
March 12, 2019
Solved

Email Script token using in Email From field?

  • March 12, 2019
  • 1 reply
  • 3888 views

Hi All,

Can you confirm if we can use Email Script token in Email's From field? We have a case, where such token is used in email body, and it works fine however, we are unable to send test email, using other person field to populate data from this token when it is also used in From field.

Weird thing is that it works perefectly in Preview email option.

Can you please advise?

Thanks,

Kacper

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

So we are trying to receive something as per below:

With above set up population in From field does not work.

It seems to be working with simplified logic:

Can you please validate what we are doing wrong? Any chance that we can achieve something closer to what you can see on the first screen?

We are assuming that we may have field mainsession with value Sydney only, so we need default logic for this part a well.

Thanks,

Kacper


Use a collection-centric approach here:

#set( $peopleBySession = {

"Sydney May 05|Sydney October 19" : "Person 1",

"Sydney June 06|Sydney July 17|Sydney August 19" : "Person 2",

".*Sydney.*" : "Person 3",

".*Munich.*" : "Person 4",

".*Warsaw.*" : "Person 5",

".*Madrid.*" : "Person 6",

".*" : "Some other persion"

} )

#foreach( $rule in $peopleBySession.entrySet() )

#if( $lead.session.matches($rule.getKey()) )

$rule.getValue()

#break

#end

#end

Also, remember (I seem to say this on every Velocity thread) you should not be using formal notation, let alone quoted formal notation, in simple #set statements.

This:

#set( $mainsession = "${lead.session}" )

should be this:

#set( $mainsession = $lead.session )

(Although you don't necessarily need an intermediate variable at all if you reduce repetition.)

1 reply

SanfordWhiteman
New Participant
March 12, 2019

It works fine.

You shouldn't be using Send Sample to test Velocity tokens. Use real emails only (this is noted all over past Nation posts).

Kacper_Gawlik1
New Participant
March 12, 2019

Hi Sanford,

What do you mean by real email?

I tried sending that via Smart Campaign, still able to receive only those that do not have token in From field.

Any thoughts? Script may have some flaws?

Thanks,

Kacper

SanfordWhiteman
New Participant
March 12, 2019

Script may have some flaws?

Certainly. The feature is supported so the error has to be elsewhere.