I'd like to create an SSJS script which retrieves bounced emails from a send activity. I've tried testing by creating a simple landing page and started by retrieving sent emails for now, but it just returns a list of commas:


Here's the landing page html that I am using:

 <script runat="server">    


<body style="font-size: 12px;color: #000099; font-family: verdana;">

<script runat="server">
var singleSend = Send.Init(573180);
var results = singleSend.Tracking.TotalByInterval.Retrieve('Send', '01-01-2014', '07-31-2014', 'day');
Write('<p>' + results + ' </p>');


<script>Write('<p>' + results + ' </p>');</script>



I'm assuming that '506903' is the tracking "Job ID" that's displayed in the tracking interface. Can anyone explain why this does not work?

  • Did you mean 506903 instead of 573180 in your code?
    – Timothy
    Apr 22, 2014 at 20:24
  • Yes, sorry I meant 573180 Apr 23, 2014 at 20:58

1 Answer 1


In place of:

Write('<p>' + results + ' </p>');


Write('<p>' + Stringify(results) + ' </p>');

That will help display the structure of the object.

The results variable is an array of hashes which is why just using Write() doesn't output it correctly.

Example Code for looping through the array and pulling out the fields from the hash:

var arrayLength = results.length;
for (var i = 0; i < arrayLength; i++) {
    Write('<p> Start: ' + results[i]['RangeStart'] + ', End: ' + results[i]['RangeEnd'] + ', Total: ' + results[i]['Total'] + ', Unique: ' + results[i]['Unique'] + '</p>');

Edit: Also the 2nd line where it is using Write() needs to have the script tag include the server-side attribute. Currently:

<script>Write('<p>' + results + ' </p>');</script>

Change to:

<script runat="server">Write('<p>' + results + ' </p>');</script>

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.