Mail snooping


Having users sneak on themselves: well I really can't condone this. Oh no no no. But hey, it was fun to code…

Many organisations have problems with the size of their users' mail files. You can set up the mail quota system, even use shared mail!!) and do various other tricks to work with this issue. At our place, we already have scans for ludicrously-sized mail files, which are then imported in to a Notes database, from where stern warnings can be sent (via Notes mail. Hah! Oh the irony…).

The code

The code I append here is designed to be run from a form Queryopen or Postopen event, but could be easily tweaked for use pretty much anywhere. The idea was that we sent out a stored form to users, and as they opened it, it would scan their mail file for all documents > 3MB in size. The resulting document collection would be looped, and various details about those documents logged in a simple email, which was then sent back to the Notes database mentioned above. OK, so you can scan mail files on the server, but that takes a lot of resource, and access to all the mail files for the agent signing ID. This code runs under the mail file owner's ID, so is much easier.

It's very simple. All user messages and things like the document size threshold are stored as constants in the (Declarations) section of the form. The code initiation, as mentioned above, sits in the relevant form event. Finally, there's a custom subroutine called ProcessDocs which actually populates the report email.

So here it is. The database contains an example form with all the code in it. To test, just dump the form in your mail file, and preview the form in Notes. After a short delay, the snooper will open with a "finished" message, and in the background it will send a report off. However before you do that, take care to edit the K_SENDTO_ADDRESS constant, as that contains the email address used by the report email!


This is very much version 1.00 code, and could bear improvement, I'm sure. Apart from anything else, there's no error trapping in the code. I'll leave that up to you…


Comments on this post are now closed.


I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.

File Attachment Icon