I've created a dynamic content block for the Customer's Salutation (based on Gender, Language, not null, etc) in MC that I want to include at the start of the opening sentence of an email, followed by a ","

For example: "Mr Beazley, your apartment request was..."

To create this, I've used the content block variable %%=ContentBlockbyID("126321")=%% followed by the ", your apartment request..."

enter image description here

The problem is when I preview this or send a test it includes a break after the content block.

enter image description here

I don't know why this is happening since:

  • No extra space in the content block elements
  • No "< br >" visible in the HTML of the email and it's not visible in the WYSIWYG editor

Any ideas on how I can address this or achieve what I'm after?

2 Answers 2


I feel your pain. I've tested this and see the same result. The following code:

<p>%%=ContentBlockById(114245)=%%, your apartment request was...</p>

Produces the following HTML output:

<table cellpadding="0" cellspacing="0" width="100%" style="min-width: 100%; " class="stylingblock-content-wrapper">
            <td class="stylingblock-content-wrapper camarker-inner">Mr Beazley</td>
</table>, your apartment request was...

Note the big dirty table. It also broke my p tags. This is why the line is breaking. But if you use:

<p>%%=RegExMatch(ContentBlockById(114245), '<td.*?>(.*)<\/td>', 1)=%%, your apartment request was...</p>

This will return the output:

<p>Mr Beazley, your apartment request was...</p>

That's the only workaround that I've been able to come up with. But it does the trick!

  • thank you for looking into this! I've tried implementing your suggested code but for some reason when previewing it doesn't show the block content - ie. it appears as ", your apartment..." I tried using a direct paste of your code without styling and one with, which looked like this: <h1 style="color:#808080;font-family:arial,helvetica,sans-serif;font-size:28px;font-style:normal;font-weight:bold;line-height:1;"> %%=RegExMatch(ContentBlockById(126321), '<td.*?>(.*)<\/td>', 1)=%%, your apartment...</h1> Apr 15, 2019 at 8:26
  • Odd, this is working for me with h1 too. I've also tried with an HTML Content Block and a Freeform Content Block and it works fine. If you send me an email at eliot[at]eliot.com.au we can jump on a call and quickly look at this together, then I can update my answer to reflect your scenario. Apr 15, 2019 at 9:27
  • Thank you for your assistance, @eliot - the code provided worked as it removes the table element that MC inserts by default. However, to solve this properly, we also had to adjust the AMPscript of the Salutation itself. Apr 15, 2019 at 11:31
  • 1
    @GregBeazley - Would you be able to provide how you adjusted the AMPscript? This information will be a big help anyone else that has this issue. Any conditions or requirements to ensure it does not result in blank return would be great to help complete this great answer. Apr 15, 2019 at 13:07
  • @Gortonington - sure. So, my goal was to show Hello or Salutation Last Name by gender and language, so there were content blocks for each Gender and the AMPscript defined the values based on Language. Apr 15, 2019 at 19:46

Try using a Code Snippet instead of a content block. Content blocks have block settings such as spacing, borders, margin, padding, background etc that could be causing that extra space.

  • Thanks @Jackson. I tried this, but unfortunately, it didn't work either :( Apr 12, 2019 at 17:22
  • @GregBeazley If you copy and paste the AMPscript in the body of the email (without using any content blocks/code snippets, etc) are you still seeing the space? Apr 12, 2019 at 17:24
  • this works, but I don't know how to make the salutation dynamic based on Gender and Language using AMPscript alone. Also, by creating a dynamic content block and using the block ID, I'm able to keep the email much cleaner. Of course, if you know how to achieve a dynamic salutation using AMPscript I'd love to see it. I haven't been able to find decent examples of what I'm trying to achieve on StackExchange or the SF Community :) Apr 15, 2019 at 8:24

You must log in to answer this question.

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