I get the following error when attempting to run an email preview:

The subscriber preview failed to generate. Review the details, correct all issues, and try again.
An unrecognized expression appears in a script block.
Script Expression: “1993”
MemberID: 7273990
JobID: 0

The following AMPScript code was used:

%%[Var @dyr<br>
SET @dyr=[Reunion Year]%%<br>
%%[IF @dyr==“1993” THEN]%%<br> 
   SET @FromName="name1"<br? 
%%[ELSEIF @dyr==“2016” THEN]%%<br>
  SET @FromName="name2"<br>
  SET @FromName="default name"<br>

what am I doing wrong? How can I fix it?

2 Answers 2


Your code was a mess of syntax issues and a hot mess in general.

  • You had HTML break tags inside the script - which is unnecessary
  • You open/closed the AMPScript brackets multiple times for no reason
  • You did not correctly label the open/close tags for AMPScript - somtimes using %[ or ]% instead of the full %%[ or ]%% syntax.
  • You used the 'magic quotes' as mentioned by @AdrianLarson - which will break inside AMPscript.

Try the below that I rewrote based on your above script:

%%[Var @dyr

   SET @dyr= [Reunion Year]

   IF @dyr=="1993" THEN 

     SET @FromName = "name1"

   ELSEIF @dyr== "2016" THEN

    SET @FromName="name2"


    SET @FromName = "default name"

  • Could you maybe throw together a quick explanatory bullet list of the fixes?
    – Adrian Larson
    Commented Feb 6, 2018 at 21:22

Don't use magic quotes (“...”). Use double quotes ("...") or single quotes ('...') instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .