Tip

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
log.
First create a new DB on the same path of the mailbox, the new db's name should
be "<your 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
line
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
mailbox
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
Error_Trap:
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) =
@Date(|+Str$(Year(dToday.Created))
+|;|+Str$(Month(dToday.Created))+|;|+Str$(Day(dToday.Created))+|)|
Set coll = dbLog.Search(search, Nothing, 0)
If Not ( coll Is Nothing ) And ( coll.Count > 0 ) Then
Set TodayDocument = coll.GetFirstDocument
Else
dToday.Form="(fmLog)"
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)
Else
Call itMachine.AppendtoTextList(machine)
End If
If ( itUser Is Nothing ) Then
Set itUser = doc.ReplaceItemValue("sUser", user)
Else
Call itUser.AppendtoTextList(user)
End If
If ( itDate Is Nothing ) Then
Set itDate = doc.ReplaceItemValue("sTime", Cstr(Time))
Else<

This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.