0

I'm looking for a way to limit the amount of characters or words inputed into a content area on a email.

The template will be html paste and the content areas would be using this code:

<custom type="content" name="Main">

I've seen some solutions on here using

length(@str1) > 5

But I'm not sure if this can be integrated with the custom content areas.

0

There's no way to do this with the way that Content Areas work. Custom content areas in templates are just placeholders. There's no point at which you can script against them after you've created your template-based email.

If you forego adding <custom type="content" name="content1"> placeholders to your template and just use named Content Areas, you'll have more opportunity to control what is displayed. For example:

%%[

var @content
set @content = ContentAreaByName("My Contents\Content1")

if length(@content) > 10 then

  outputline(concat("<br>oops, too long"))

  /* or alternatively */
  /* raiseerror("content too long, skipping email",0) */

else

  outputline(concat("<br>content1: ",@content))

endif 

]%% 

This method is good for controlling the content, but it's a more technical way to build your emails. The skills of those deploying the emails is usually the deciding factor.

For reference:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.