Does anyone know if there is a way to retrieve email body content without HTML tags? Or text version (plain text) of the email?

The case is we need to log it in Data Extension created to track Email History, therefore it would be ideal to push it as variable in AMPscript or SSJS. Nevertheless, ANY suggestions on how to get it would be much appreciated.

  • is it from classic or content builder? – Gortonington Dec 12 '18 at 13:58
  • Content Builder – mrt.swtk Dec 14 '18 at 7:56
  • see my answer below for how to get html/text from both content builder and classic – Gortonington Dec 14 '18 at 13:43

Yes, if you are creating emails in Content Builder, you can use 'Free form' content block type to create your email body.

It has three tabs: Content, Block Settings, HTML Editor. You can access Content to get the email body without HTML tags. HTML Editor

enter image description here


To retreive text only (or HTML body) of each email is different for Classic and Content Builder.

For Classic:

  1. Use a Retrieve request via SOAP to the Email Object
  2. Include the property of 'HTMLBody' and/or 'TextBody'

This will return an XML file that contains your requested data.

  <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <Filter xsi:type="SimpleFilterPart">

For Content Builder:

You would use the Content Builder assets REST API via a Simple Query (GET /asset/v1/content/assets) or via a more Advanced Query (POST /asset/v1/content/assets/query)

example: .../asset/v1/content/assets?$filter=Name%20like%20'hello%20world'

You would then retrieve the values from the returned JSON via the following paths:
"items": { views": { "html": { "content": } } }
"items": { views": { "text": { "content": } } }

You can then use the API (or if done via Script Activity/Cloudpage - AMPScript or SSJS) to insert/update these retrieved values and push into your data extension.

Your only other option (which is not recommended due to processing impact) is to do an HTTP GET inside the email on the VAWP link and then an upsert to your DE. You would want to limit it to only happen once per job or it will most definitely cause your send to time out. Also note this will pull in the final 'processed' HTML, and not include any of your AMPScript or SSJS. Also need to make sure that the HTTPGET is wrapped to not run on VAWP or you will create an infinite loop.


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.