0

The problem is that my special characters are breaking the way the HTML renders not only in SFMC Email Studio but also once the email is sent, however when I inspect the source there doesn't seem to be an issue. I can only assume this is some weird interaction between AmpScript and HTML.

Code Snippet (Inside HTML Email)

<script runat="server" language="ampscript">
  SET @stack_name_a = Concat("Stack&#160;Jordan&#160;Limited&#65279;.")
  SET @stack_address_a = Concat("P<span></span>O&#160;Box&#160;1231,&#160;Ne<span></span>wYork,&#160;NY&#160;1<span></span>12&#160;123&#160;U<span></span>SA")
  SET @stack_name_b = Concat("2&#160;Stack&#160;Jordan&#160;Limited&#65279;.")
  SET @stack_address_b = Concat("P<span></span>O&#160;Box&#160;1231,&#160;Ne<span></span>wYork,&#160;NY&#160;1<span></span>12&#160;123&#160;U<span></span>SA")
  SET @website = Concat("stackoverflow&#65279;.com")
</script>

<p style="font-size: 12px; color: #666666; line-height: 150%;">
 I am here to test this message because it does not properly format, this message is a by <span dir="ltr" style="direction:ltr; white-space: nowrap;">%%=v(@stack_name_a)=%%</span>, for <a href="" style="direction: ltr; color: #666666; text-decoration: none;">%%=v(@website)=%%</a> and i am glad this is working, my address is <span dir="ltr" style="direction:ltr; white-space: nowrap;">%%=v(@stack_address_a)=%%</span>. On the other hand, it does seem to break randomly, so i am sending another message by <span dir="ltr" style="direction:ltr; white-space: nowrap;">%%=v(@stack_name_b)=%%</span>, for <a href="" style="direction: ltr; color: #666666; text-decoration: none;">%%=v(@website)=%%</a> and i really hope it breaks for demo purposes, <span dir="ltr" style="direction:ltr; white-space: nowrap;">%%=v(@stack_address_b)=%%</span>.</p>

Result: I am here to test this message because it does not properly format, this message is a by Stack Jordan Limited., for stackoverflow.com and i am glad this is working, my address is PO Box 1231, NewYork, NY 112 123 USA. On the other hand, it does seem to break randomly, so i am sending another message by 2 Stack Jordan Limited., for stackoverflow.com and i really hope it breaks for demo purposes, P O Box 1231, NewYork, NY 112 123 USA.

The Problem: P O Box 1231, NewYork, NY 112 123 USA was rendered incorrectly, PO should be together. I am assuming that some of the special characters I am using are breaking the interaction between AMP Script and HTML.

So far I have tried to use v, TreatAsContent and Concat. I can't figure out how to resolve this. Any advice would be appreciated. Thanks.

1 Answer 1

0

I figured out the issue I think. Email Studio does not use proper HTML rules for emails, in fact I am unsure which rules it is using. However as of HTMlL 4.0.1 you can have both span tag inside of a tag and vice versa.

In salesforce email studio, you must apparently use span tag before an a tag, if you want to have more inline span tags.

It would be nice to know why SFMC has this awkward interaction but I couldn't find any relevant documentation on it.

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.