我是菜鸟,对开发从未涉及.但由于我管理的DOMINO上的用户经常不及时清除自己的邮箱,常常让我的服务器硬盘爆满!我想自己开发程序,自动清除用户邮箱中的发件箱和1月前收件箱的邮件.不知从何入手,请朋友们赐教!最好讲的基础一些!
不胜感激!
------解决方案--------------------
将如下代码拷贝到一个新的数据库,此数据库放在你的邮件服务器上。然后将它做成自动代理(根据你的需要设置多久运行一次),权限设置为2。
然后退出数据库,设计,使用服务器ID对数据库进地签名。
就可以了。
注意一定的备份原来的邮件,不然如果有人重要邮件找不到了,你就死定了。
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim ndb As NotesDatabase
Set db=s.CurrentDatabase
Set ndb=s.GetDatabase(db.server, "names.nsf ")
Dim nview As NotesView
Dim ndoc As NotesDocument
Set nview=ndb.GetView( "People ")
Set ndoc=nview.GetFirstDocument
Dim MailFile As String
Dim UserMailDb As NotesDatabase
Dim dc As NotesDocumentCollection
i=0
While Not ndoc Is Nothing
If i> 10000 Then
Msgbox "死循环了,退出 "
Exit Sub
End If
MailFile=ndoc.MailFile(0)
Set UserMailDb=s.GetDatabase(db.Server,MailFile)
If UserMailDb.IsOpen Then
Set dc = UserMailDb.Search( "@Created < [2007-06-08] ",Nothing,0)
'这里的2007-06-08就是你的时间,你想删除到那天的就改这个时间就OK了。
If dc.count> 0 Then
Call dc.RemoveAll(True)
End If
End If
Set ndoc=nview.GetNextDocument(ndoc)
i=i+1
Wend
End Sub