I produce daily summaries via the API for our own internal reporting to our inhouse billing system.
pretty easy to do
vb.Net code below (nowhere near complete, but gives you the general idea)... should be able to easily be adapted into whatever language is your preference.
Add a Web Reference to SmarterMail.DomainAdmin and SmarterMail.UserAdmin
Public Class MailboxItem
Public Property Name As String
Public Property InCount As Long
Public Property OutCount As Long
Public Property InBytes As Long
Public Property OutBytes As Long
Public Property CurrentSize As Long
Public Sub New(strName As String)
Name = strName
InCount = 0
OutCount = 0
InBytes = 0
OutBytes = 0
CurrentSize = 0
End Sub
End Class
Dim theDomains As New List(Of String)
Dim theMailboxes As New List(Of MailboxItem)
'query to get list of domains
Dim domAdmin As New SmareterMail.DomainAdmin.svcDomainAdmin
Dim domListResult As SmarterMail.DomainAdmin.DomainListResult = domAdmin.GetAllDomains(adminUsername, adminPassword)
If domListResult.Result = True Then
For Each s As String In domListResult.DomainNames
theDomains.Add(s)
Next
End If
'for each domain get list of mailboxes
For Each strDomain As String In theDomains
Dim usrAdmin As New SmarterMail.UserAdmin.svcvUserAdmin
Dim usrInfoListResult As SmarterMail.UserAdmin.UserInfoListResult = usrAdmin.GetUsers(adminUsername, adminPassword, strDomain)
If userInfoListResult.Result Then
For Each obj As SmarterMail.UserAdmin.UserInfo In usrInfoListResults.Users
Dim mb As New MailboxItem(obj.UserName)
theMailboxes.Add(mb)
Next
End If
Next
'For each mailbox pull the stats
For Each mItem as MailboxItem in theMailboxes
Dim usrAdmin As New SmarterMail.UserAdmin.svcUserAdmin
Dim usrStatInfoResult As SmarterMail.UserAdmin.StatInfoResult =
usrAdmin.GetUserStats(
adminUsername,
adminPassowrd,
mItem.Name,
CDate(strDate + " 00:00:00"), CDate(strDate + " 23:59:59"))
If usrStatInfoResult.Result = True Then
mItem.InCount = usrStatInfoResult.MessagesReceived
mItem.OutCount = usrStatInfoResult.MessagesSent
mItem.InBytes = usrStatInfoResult.BytesReceived
mItem.OutBytes = usrStatInfoResult.BytesSent
mItem.CurrentSize = usrStatInfoResult.BytesSize
End If
Next
At that point the list of MailItems (theMailboxes) will contain the mailbox name, the In/Out counts and In/Out bytes size totals as well as the current size of the mailbox. Loop thru it and dump into whatever form of reporting you prefer.
Hope that helps anyone who needs it