0

Ive created a data extension with several attributes , one of them being pre header. This is where my content lies. When I add ampscript in my email it pulls the pre header however when I do the real send it does not show

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Mar 28 at 6:25

1 Answer 1

3

You need to set the value of your dynamic preheader in HTML before your opening tag, like this:

Preheader : %%=v(@preheader)=%%

HTML:

<html>
  %%[
    SET @firstname='Alex'
    SET @preheader = Contact('Welcome ',@firstname)
  ]%%
  <body>
    Insert some email content here
  </body>
</html>

Source: Salesforce Documentation

If you want to avoid showing the actual content of the email, you can add this fix, to add whitespaces just after the preheader. It will "push" the actual email content further into the email, so you avoid showing it in inbox list view:

IF _messagecontext == 'SEND' THEN
    SET @preheaderLength = length(@preheader)
    SET @maxLength = 120
    SET @spaceFill = subtract(@maxLength, @preheaderLength) 
    FOR @counter = 1 to @spaceFill do 
        SET @preheader = CONCAT(@preheader,'&#847;&zwnj;&nbsp;') 
    NEXT 
ENDIF

This one is based on this good article from Litmus

2
  • Thank you! It worked however after the pre header I see the Main text string showing after I just want the Subject line and pre header to show before opening mailer
    – Molo
    Commented Mar 28 at 10:52
  • Sure, @Molo - please see my updated answer. And don't forget to mark my answer as accepted if it has been helpful. Commented Mar 28 at 11:31

You must log in to answer this question.

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