Prettying up AMPScript in emails

When you’re creating a dynamic email in Salesforce Marketing Cloud using AMPScript, things can get muddled up with non-HTML code real fast — so muddled it’s hard to recognize the basic layout of the email. ย Sometimes it’s helpful to hide the AMPScript in a way that doesn’t affect the functionality. Here’s a trick that I use on a regular basis.

Hide your init block in with a styled DIV

I normally use these at the top of an email for initialization of variables, etc. Simply edit the content area to view the full code.

DO NOT use HTML comments to hide AMPScript. It will screw up the automatic text version of your email!

Leave a Reply

5 Comments on "Prettying up AMPScript in emails"

Notify of
Sort by:   newest | oldest | most voted
Vic Dinovici

Great article series about Exact Target, Adam!

For me the most problems rise into the plain text file with AMPscript. Where is AMPscript remains an empty space and is just awfull sometimes as I spend more time to make things nicer into the .txt file than coding.

Thanks for tips again, just subscribed to your feeds.



Thanks for sharing your knowledge in all your posts. This tip is really useful.

Though, I do not understand one thing:
why this piece of code /* your big blob of AMPScript goes here */ is commented and how can be executed since it is commented?

I’m saying this knowing that the /* …*/ is for comments or non-executed notes.