Some users just constantly ignore the corporate IT notice to housekeep their mail databases. This is giving administrators headaches.
This agent can be incorporated into the mail template and distributed to all mail databases to help housekeeping their e-mails daily.
Just plucked in the mail database size quota value into the 'IsOverQuota' function and then specify the age (number of days) in the 'RemoveMails' subroutine and finally schedule the agent to run daily at an off peak hours.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
Don't forgot to make an official announcement and jot it down black and white, else IT will have another headache again!
Dim session As NotesSession
Dim db As NotesDatabase
Set session = New NotesSession
Set db = session.CurrentDatabase
'If mail box is over 50 MB, remove 120 days old mails.
If IsOverQuota (50) Then
Call RemoveMails (120)
Function IsOverQuota (iQuota As Integer)
'iQuota is in Megabytes
Dim quota As Long, CurrSize As Double, MaxSize As Double
'Converts DB size to Megabytes
CurrSize = Round (db.Size/1000000, 2)
MaxSize = Cdbl(iQuota) ' Megabytes
If CurrSize> MaxSize Then
IsOverQuota = True
IsOverQuota = False
Sub RemoveMails (iMailAge As Integer)
'iMage Age is in number of days
Dim strSearchFomula As String
Dim docCollection As NotesDocumentCollection
Dim strMailAge As String
'Convert the number days to string as Notes Formulae is formatted as string
strMailAge = Cstr(iMailAge)
strSearchFormula = "DeliveredDate < @Adjust(@Today;0;0;-" + strMailAge + ";0;0;0) | PostedDate < @Adjust(@Today;0;0;-" + strMailAge + ";0;0;0)| @Created < @Adjust(@Today;0;0;-" + strMailAge + ";0;0;0)"
Set docCollection=db.Search(strSearchFormula, Nothing,0)
'Remove the old documents
If docCollection.Count <> 0 Then