Manage Learn to apply best practices and optimize your operations.

Does Somebody Open Your Mailbox, Besides You?

A lot of times we work in a development environment where everybody has the
password one of the other ones for several reasons.
With this, other people can read our mailbox.
With this tip, we will have control to know if and when somebody opened our
mail box from his/her workstation, it gets the windows library to know whom is
the computer that is openning the mailbox and who is doing that, through the
computer and the user that are logged in on the network.
It puts it in a separate database, so that the intruder doesn't discover the
First create a new DB on the same path of the mailbox, the new db's name should
be "&LTyour mailbox file name>_log.nsf" and deselect " show in 'open database'
dialog in the db's design properties. Create a form named "(fmLog)" and insert
four computed fields on it:
1 - name: dtCreated type: date/time(only date) default value: dtCreated
Field 2, 3,4 should be type text and allow multi-values and separator is new
2 - name: sTime default value: sTime
3 - name: sMachine default value: sMachine
4 - name: sUser default value: sUser
Create a view for this form with the name you want, the first column
categorized by field dtCreated.

On your mailbox create this script library named "DocumentProcessing":

Paste it on Declarations of script library "DocumentProcessing":

Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (Byval
lpBuffer As String, nSize As Long) As Long
Declare Function GetUserName Lib "advapi32" Alias "GetUserNameA" (Byval
lpBuffer As String, nSize As Long) As Long

Paste it on Initialize of script library "DocumentProcessing":

'This is the startup when you or anybody opens yourself or somebody's
Sub Initialize
On Error Goto Error_Trap
Dim ns As New NotesSession
Dim db As NotesDatabase
Dim dbLog As NotesDatabase
Dim server As String, path As String
Dim lpBuffer As String
Dim lpBufferUser As String
Dim doc As NotesDocument
lpBuffer = String(255, Chr$(0))
lpBufferUser = String(255, Chr$(0))
Call GetComputerName(lpBuffer, 255)
Call GetUserName(lpBufferUser, 255)
Set db = ns.CurrentDatabase
server = db.Server
path = dbPath(db)
Set dbLog = ns.GetDatabase( server, path )
Set doc = TodayDocument(dbLog)
Call RetrieveAccess(lpBuffer, lpBufferUser, doc)
Call doc.Save(True, False)
Exit Sub
Exit Sub
End Sub

Add this Function to script library "DocumentProcessing":
'This function verifies whether we already have a today document or not.
If we have then it gets the document and return it,
'if not it creates a new one and return it

Function TodayDocument(dbLog As NotesDatabase) As NotesDocument
Dim dToday As NotesDocument
Dim coll As NotesDocumentCollection
Dim search As String
Set dToday = dbLog.CreateDocument
search = |Form ="(fmLog)" & @Date(@Created) =
Set coll = dbLog.Search(search, Nothing, 0)
If Not ( coll Is Nothing ) And ( coll.Count > 0 ) Then
Set TodayDocument = coll.GetFirstDocument
dToday.dtCreated = Today()
Set TodayDocument = dToday
End If
End Function

Add this Sub to script library "DocumentProcessing":

'This sub verifies though the windows library whom is the computer that is
accessing your mailbox and who is doing it
'Then it puts into the form the data that were retrieved by the script:
computer, user and time

Sub RetrieveAccess(machine As String, user As String, doc As NotesDocument)
Dim itMachine As NotesItem
Dim itUser As NotesItem
Dim itDate As NotesItem
Set itMachine= doc.GetFirstItem("sMachine")
Set itUser = doc.GetFirstItem("sUser")
Set itDate = doc.GetFirstItem("sTime")
If ( itMachine Is Nothing ) Then
Set itMachine = doc.ReplaceItemValue("sMachine", machine)
Call itMachine.AppendtoTextList(machine)
End If
If ( itUser Is Nothing ) Then
Set itUser = doc.ReplaceItemValue("sUser", user)
Call itUser.AppendtoTextList(user)
End If
If ( itDate Is Nothing ) Then
Set itDate = doc.ReplaceItemValue("sTime", Cstr(Time))

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...