I have setup a cloudPage associated with a journey and as soon as a subscriber joins the event there is a welcome email which I am sending out as part of customer journey.

We would like to change this email as a personalized email with first name greeting but what happens when somebody enters a false first name "Siht"/ "Xyz" etc. it will say hello xyz. right now we can use first name with the help of personalization but can't validate some specific words.

Is there a way I can create a one time spam words library and use it as an exclusion with the help of ampscript.

  • 4
    Why do you care what your customer enters for their name? If they enter a false name, they're probably not going to want to engage with you further no matter what you decide to call them. I like to urge caution when trying to filter "bad" words because most implementations just do a simple find/replace, and they're generally comically easy to circumvent (e.g. ass -> a$$, you'll never catch all of the possible variants). Plus, one surefire way to lose a legitimate customer is to blindly replace the salutation for "Mr. Lipshitz" with "Mr.Lip<profanity removed>z"
    – Derek F
    Apr 10, 2018 at 20:23

2 Answers 2


As @DerekF stated, this is not really necessary or best practice - but if you still want to get it done, it can be done (kinda) via AMPScript. It would just be a limited solution and purely based on the list you set up.

I would not recommend doing an indexof or partial match and replace (again as Derek F said) this could wind up with Mr. Lipz or similar which is bad UX.

My recommendations, if you must do something, is the following:

  1. Create a Data Extension (DE) that contains a list of the words you want to filter.
  2. Inside the email use something similar to the following AMPScript:

  SET @FName = AttributeValue("FirstName")
  SET @Lookup = LookupRows(yourFilterDE, "Word", @FName)

  IF ROWCOUNT(@Lookup) > 0 THEN

     SET @FName = "Customer"


This will give you a full replace with a default value if the word is profane or garbage, but it will only work on an exact match. This is a pretty shoddy solution, but is likely the best you will be able to get via AMPScript.

  • Thank you @Gortonington for your inputs. I really appreciate this. I will test it and will confirm Apr 11, 2018 at 14:56

It is probably a better idea to have client side validation using JS to prevent the form being submitted in the first place.

You want to have clean data that is usable rather than any submitted data go into SFMC.

You must log in to answer this question.

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