Using Brackets in the Email Body

Modified on Sun, 30 Apr 2023 at 07:18 PM

For the most part, you can type any content into the body of an email template that your agency needs. You can use formatting and add images. You can use replacement fields as needed anywhere within the email body. One exception to this is the use of brackets (or square brackets). Brackets are reserved because they are used for replacement fields.


Email replacement fields are delimited by brackets []


For example: [FIRST NAME]


By typing this directly into an email template, the users first name will be filled in when the campaign is generated. Instead of typing the name of the field, it is reccommended that you use the replacement fields on the right side of the email editor. By clicking the field you want, you can insert it into the email template and not worry about any typos.



The replacement fields look for patterns of text within your email template and replace them as needed. Because you have full access to the email content, it is possible to enter an invalid replacement field.


For example: [FIIRST NAME]


Note that the above replacement code has a typo and has two I's in the word "first". This is almost undetectable when you are looking at template. When the replacements run, they will not match the pattern of text and nothing will be replaced. This simple typo can lead to improperly formatted emails being sent. 


It is also possible to format part of a word which will cause the underlying HTML to be broken apart.


For example: [FIRST NAME]


Note that we bolded the first word of the replacement field. By doing so, the underlying HTML breaks apart the two words even though they look the same. When this happens, they will not be replaced. These issues can be subtle and can cause errors if a template is edited and not previewed for accuracy. As always, it is recommended that emails be previewed before sending campaigns and that a full review should be done after any template edit.


As a safeguard, a setting is built in that will cause possible errors in your templates to be suppressed. The setting is called "Do Not Allow Brackets In Emails"



When this setting is true, if an email is generated and a bracket exists in the body of the email, it will be suppressed. This is a safeguard to prevent possible mistakes in your template. The side-effect of using this setting is that it does not allow you to type brackets into your email template unless they are part of a replacement field.


As a best practice, it is recommended that you use this setting and avoid using brackets in your email templates. This way any email preview that contains a bracket will be treated as an error. Consider if you really need brackets in your template and if not, use an alternative such as parentheses. 


Exceptions


There are some minor exceptions to this rule. The single use case in which brackets are allows is for using a set of empty brackets as show below:


[]

[ ]

[  ]

[   ]


All of these combinations are allowed even when Do Not Allow Brackets in Emails is set to true. Each option has a variable number of spaces in side of the bracket set.


Error Messages


If you have a possible bracket issue. You can expect to see an error when editing the template. For Example:


This email may contain invalid replacement fields. Brackets were detected within the body that do not match known replacement fields.


If you are not uploading customer data, you may be getting this error because it cannot validate the template against customer data. This can occur for agencies that are uploading document or email files and not uploading consumer files. In this case, it may be safe to ignore the message. The system cannot determine if the fields exist, because they are being imported only when the data file is recieved and may not exist when building the template. If you are seeing this message, make sure you verifying the email before sending. 





Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article