Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Delete Mail Messages in Sent Folder

Status
Not open for further replies.
Sep 30, 2003
29
0
0
US
We have a mail account (Notes ver 6.5.2) setup to just send out AS400 reports to users, the problem is that the "sent" folder gets huge and we have to manually go in and delete. Is there a way either using rules or something else that we can setup to automatically delete these messages after 1 week.

Thanks in advance for anyones help!

Mitchellmj
 
You can set up an agent that deletes everything in the view. You can use the following code :
Code:
Dim session As New notessession
Dim db As notesdatabase
Dim view As notesview
Dim doc As notesdocument

Set db = session.CurrentDatabase
Set view = db.GetView("($Sent)")
Set doc = view.GetFirstDocument
Do While Not(doc Is Nothing)
	Call doc.Remove(False)
	Set doc = view.GetFirstDocument
Loop
Put this code into an agent and schedule it to run every week (or every day if really necessary).

Pascal.
 
I could do with code very similar to this but only deleting sent items over a certain age... say 14 days?

Regards,
Tony.
 
Either make a view that only holds docs that are more than 14 days old and direct the above code to it, or amend the above code to include something like this :
Code:
Dim DocDate as notesdatetime
Dim NowDate as notesdatetime
Dim createdDate as string

...
Set NowDate = new notesdatetime(now)
call NowDate.adjustday(-14)
...
createdDate = trim(str(doc.created))
set docdate = new notesdatetime(createdDate)
if docdate.timedifference(nowdate) < 0 then call doc.remove(false)

That should work (with a little bit of tweaking perhaps).

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top