_messagecontext String

The _messagecontext string allows you to use pre-defined definitions around the status of a Marketing Cloud assets.

  • SEND – Display the rendered final message for sending to subscriber
  • PREVIEW – Display the send preview options available within editor
  • VAWP – Display content
  • VIEWSENT – Display the non-subscriber link to preview content
  • FTAF – Display the rendered Forward To a Friend message
  • LANDINGPAGE – Display a landing page or microsite
  • VALIDATION – Display information corresponding to the validate option in Marketing Cloud
  • LINKRESOLUTION – Display resolved dynamic script at click time
  • SMS – Display SMS message content
  • SOCIAL – Display Social Forward content
  • SITE – Display CloudPage content

Example:

					

%%[
IF _messagecontext == ‘SEND’ THEN
UpsertDE(‘DataExtensionSendLog’, 1, ‘EmailAddress’, @EmailAddress, ‘DateSent’, NOW())
ENDIF
]%%
%%=v(@GUID)=%%

Output:

EmailAddressDateSent
test@testemail.com01/03/2020 8:52AM

Explanation:

In this example, an UpsertDE is used to add a row to a data extension with the Email Address and the DateSent using the time now. The UpsertDE will only run for email sends because in this example, there is an IF statement wrapped around the UpsertDE. The IF statement is using the _messagecontext == ‘SEND’ meaning, if the email is a send.

2 comments

    1. Let me know if you find out. Only thing I’ve gotten from documentation is: LINKRESOLUTIONDisplay resolved dynamic script at click time

Leave a Reply

Your email address will not be published. Required fields are marked *