Is there a way to bulk export the HTML or Text versions of emails sent?




Wondering about doing text analysis of some emails vs their performance, but unsure how I might get their content out of campaign & into another tool to analyse at scale?


Accepted Solutions (1)

Accepted Solutions (1)



Hi @Stephenjqz !

I've been trying to do this lately... i'm sure others can assist, but you can pull the HTML or Text content out using the Generic Query Editor (see screenshots attached) or using Deliveries->export fields using the same sort of criteria.   Not the most elegant but a good start for a one off export/download of HTML.

screenshot 2 - html code saving.jpg

screenshot 3 - html code saving.jpg

screenshot 1 - html code saving.jpg

I also have written some draft javascript code below to get the HTML filzesize in KB for deliveries (raw total size, includes all personalisation blocks for example so may not be the final size that a customer receives in their inbox) which you can take or leave below (i;m sure it can be written more elegantly).


function getByteLen(normal_val)


    // Force string type

    normal_val = String(normal_val);

    // Split original string into array

    var normal_pieces = normal_val.split('');

    // Get length of original array

    var normal_length = normal_pieces.length;

    // Declare array for encoded normal array

    var encoded_pieces = new Array();

    // Declare array for individual byte pieces

    var byte_pieces = new Array();

    // Loop through normal pieces and convert to URL friendly format

    for(var i = 0; i <= normal_length; i++)


        if(normal_pieces[i] && normal_pieces[i] != '')


            encoded_pieces[i] = encodeURI(normal_pieces[i]);



    // Get length of encoded array

    var encoded_length = encoded_pieces.length;

    // Loop through encoded array

    // Scan individual items for a %

    // Split on % and add to byte array

    // If no % exists then add to byte array

    for(var i = 0; i <= encoded_length; i++)


        if(encoded_pieces[i] && encoded_pieces[i] != '')


            // % exists

            if(encoded_pieces[i].indexOf('%') != -1)


                // Split on %

                var split_code = encoded_pieces[i].split('%');

                // Get length

                var split_length = split_code.length;

                // Loop through pieces

                for(var j = 0; j <= split_length; j++)


                    if(split_code[j] && split_code[j] != '')


                        // Push to byte array







                // No percent

                // Push to byte array





    // Array length is the number of bytes in string

    var byte_length = byte_pieces.length;

    return byte_length;


var query = xtk.queryDef.create( 

  <queryDef schema="nms:delivery" operation="select">   


      <node expr="@id"/>

      <node expr="@label"/>



      <condition bool-operator="AND">

        <condition expr="@id > 100000000"/>

        <condition expr="@id < 110000000"/>






var res = query.ExecuteQuery()

var i = 0;

for each (var delivery in




  var id = delivery.@id.toString();


  var content =;

/*  logInfo(delivery.@label.toString() + " - Size KB  : " + (getByteLen(content)/1024).toFixed())  */

  logInfo(delivery.@id.toString() + "|" + (getByteLen(content)/1024).toFixed())


  if(i > 10)




Answers (4)

Answers (4)



Hi David,

I can see in your post that we are able to pull the html content from deliveries.But is it actual email content or just template we are getting out of that html?

Because I have a requirement to pull out the email content sent to the customer from campaign,Is there any way to pull the actual email content from campaign?




Hi Steven

Sure - I was just wondering if there was a way to do it at scale rather than individually.

Exact detail of what we were going to do we haven't pinned down yet - we have some html processing options & some word/phrase extraction stuff we're looking to try out.





You will be able to extract the HTML versions of the deliveries by going into the delivery itself and saving the contents as a HTML file by selecting the save button.

Could I confirm if you are wishing to investigate a correlation between the the volume of data in the email vs the deliverabilty? What parameters are you wishing to include in your analysis?