Need Report/View of amount of mail in mailboxes

This forum is for discussing Mailtraq's Scripting features. Get help with Mailtraq scripts, templates and external ActiveX scripting.

Need Report/View of amount of mail in mailboxes

Postby gsnyd » Thu Mar 01st, 2012 2:16pm

Can this be accomplished with a script or template? I was reviewing the accounting template but it doesn't contain everything I need.

I need the mailslots listed:
I need count of mail in each mailslot.

We need this for reporting and troubleshooting. One quick view would let us know if a mailbox was not getting the mail pulled.

It would be a bonus if this could be pulled up in a webpage so the support group can look immediately and see all mailboxes and their mail count.

Can someone point me in the right direction?
gsnyd
 
Posts: 2
Joined: Tue Dec 13th, 2011 5:29pm

Re: Need Report/View of amount of mail in mailboxes

Postby Elric Pedder » Fri Mar 02nd, 2012 1:36am

Take the script below and save it as the file "mailcount.asp" in your WebMail directory, then just browse to it (something like http://localhost/mailcount.asp). Everything here is documented at the Mailtraq Server-Size Script Reference.

Code: Select all
<@LANGUAGE=Javascript@>

<html>
  <head>
    <title>Mailbox Summary</title>
  </head>
  <body>
    <table>
     <tr>
       <td>Mailbox</td>
      <td>Message Count</td>
      <td>Mailbox Size</td>
     </tr>
<%

  var mailslots = Config.GetAllMailslots().split(',');
  for (var i = 0; i < mailslots.length; i++)
  {
   var mailslot = Config.GetMailslot(mailslots[i]);
   var info = mailslot.QueryFolders().split(',');
   var count = 0;
   var size = 0;
   for (var j = 0; j < info.length; j += 6)
   {
     count += (info[j+2] * 1);
     size += (info[j+4] * 1);
   }
   Response.Write('<tr>');
   Response.Write('<td>' + mailslot.Name + '</td>');
   Response.Write('<td>' + count + '</td>');
   Response.Write('<td>' + ((size >> 10) / 1000) + 'mb</td>');
   Response.Write('</tr>');
  }

%>
    </table>
  </body>
</html>


I haven't addressed security and other issues so you should consider adding some sort of login or putting it in a separate web site with IP based access control.
Mailtraq Development and Escalation Support
Novitraq Incorporated
User avatar
Elric Pedder
Mailtraq Escalation Support
 
Posts: 2675
Joined: Tue Nov 23rd, 2004 1:16pm
Location: Montreal, Canada


Return to Mailtraq Scripting

Who is online

Users browsing this forum: No registered users and 3 guests

cron