I am creating an email in Marketing Cloud and I'd like to add a First Name personalization to the email Subject.

We have some AMPScript to e.g. capitalize the name etc, which creates the variable @Subject.

At the moment, I am just copying and pasting this AMPScript into one of the email's content blocks via the content block's HTML Editor, and then adding in %%=v(@subject)=%% into the subject line when sending the email. This seems to be working in the email preview and test.

However, a colleague has told me that this method will cause issues, and that the AMPScript must be at the very top of the email HTML in order to work correctly. Her current method to do this is to create an email using content blocks, copy and the email's entire HTML code, create an HTML email and paste that HTML code into it, then insert the AMPScript into line 1 of that HTML, and send the email as an HTML email.

I have to believe that there's an easier way to add in the AMPScript, does it have to be at the top of the HTML code, or can it just sit somewhere within a content block in the email itself?

1 Answer 1


This is the order of operations:

Order of Operations

AMPscript processes functions in this order:

1 HTML Body
2 Text Body
3 Subject Line

Any preheader values reside at the beginning of the body and process accordingly.

Source: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/orderOfOperations.htm

So there is no impact for subject line, just for the preheader: subject lines can be place anywhere inside the email, but the preheader must be at the very beginning, before the HTML body.

  • It's my understanding that email headers are the first thing to be processed -- i.e. Sender Profiles.
    – Daniel
    Commented Jun 3, 2021 at 1:56

You must log in to answer this question.

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