Lotus Notes FAQ Visit Our Sponsor!

How do you limit the size of users' mail boxes?

Notes 4.x has Database Quotas that you can apply to a database; you can access these under the Database Tools of the Server Administration menu.

If you would like to warn users more directly, you can put this in the mail templates's Database Script PostOpen event:

Sub PostOpen(Source as Notesuidatabase)
     Dim db As NotesDatabase
     Dim MaxSize As Double, CurrSize As Double
     Set db=source.Database
     Maxsize = 20     'Megabytes
     CurrSize = Round( db.Size/1000000, 2)
     If CurrSize > MaxSize Then
       MsgBox "Your mail database exceeds the corporate " _
       & "maximum size of " & MaxSize & " Mb. Your mail " _
       & "database is " & CurrSize & " Mb and contains " _
       & db.AllDocuments.Count & " documents.  Please " _
       & "remove or archive old messages. If you " _
       & "require assistance, please contact IS.", 0, _
       "Mail Database Needs Archiving"
     End If
End Sub

Other techniques suggested by ThomasMcA@dawnfoods.com:
1) I created a DeleteAttachments button in our Inbox & All Docs views that *deletes* the attachments in any selected doc. This lets them keep the doc itself, but remove the large attachments.

2) I created a Size column [ @Round(@Sum(@DocLength )/1024) ] in the above views that lists the size of each document. It really helps for the users to see the size of every doc w/ attachments (Wow, it's THAT big?!?!?!? :-) Lotus added a similar column to the R5 mailbox, but they display bytes instead of KB. I think that clutters up the view, and wastes column space. The above formula shows KB, and that's what I use for the column heading - KB.

3) I created an agent that loops through all of the mail files, checks the size, and sends them and myself an e-mail that says it's too big. The agent is signed by the server, so it looks like it came from the server, not from me.

4) I added code to the Initialize event for the mail template that also checks the size of the db, and pops up a messagebox that says "your mailbox has exceeded XX megabytes".

4b) Part of me hated to have to implement this next feature, and I regularly apologize to my users for having to implement it. Since it is human nature to just click OK to the above warning, the code pauses for 10 seconds for every 5 meg. So it displays a message for 25 meg, pauses 10 secs, displays another for 30 meg, pauses, etc. So the more you abuse the system, the longer you have to wait.

5) I also added the above code (via a script library, of course) to the New Memo buttons. If the user ignores all of the above methods/warnings, they have to wait for the above messages and pauses each time they try to create a new memo.

6) I created an Attachments view in the mail template that only displays docs with attachments. A Size column displays the size of each attachment.

7) I soon discovered that even all of the above steps were not enough to stop the determined email quota abuser. So I created a new "over quota" mail template with the following features:

7a) A "before mail" agent that compares the user's quota to the size of their mailbox. If they are over their quota, a Readers field is used to hide the new message from the user (but it's still in their mailbox, so it still counts toward their quota). A message also gets deposited into their Inbox that says "You have mail being held from <User Name>. Subject: <subject>". The body of that note tells them that the message will get released after they cleanup their mailbox, and it contains links to self-help documents in our FAQ database.

7b) A scheduled agent that compares the user's quota to the size of their mailbox. If they are UNDER their quota, it unhides all hidden messages by removing the Readers field. Schedule this agent as often as your users are willing to wait for email to get released, but not so often that you overload your servers.

7c) A hidden view that shows messages that have been hidden by the "over quota" agent. This is used by the agent to loop through hidden messages, and by the admins to look for hidden messages during troubleshooting.

7d) Since this creates 2 agents for every mailbox that uses this template, I only convert a user to use this "over quota" template when I notice that they are regularly close to their quota

Applies to Notes Versions: 4.5, 4.6, 5
Last Modified: February 27, 2006