Access mail database from an agent

my problem is i want to access my mail folder in doimino /data . i want to create a replica of allthe mail database from time to time for back up purpose

i am able to access domino folder and the database in the server but i only want the mail database from the server.

plz the code once

'Dim dbdir As New NotesDbDirectory("TESTMAILSVR1/TESTMAILCERT")

Dim directory As NotesDbDirectory

Dim session As New NotesSession

Dim db As NotesDatabase

Dim replica As NotesDatabase

'Set db = session.CurrentDatabase()

'Set db = dbdir.GetFirstDatabase(DATABASE)

Set directory = session.GetDbDirectory("TESTMAILSVR1/TESTMAILCERT")

Set db = directory.GetFirstDatabase(DATABASE)

Msgbox db.FileName

Call db.open("","") 

Set replica = db.CreateReplica("", db.FileName)

plz help!!!

Subject: access mail database from an agent

you can find all mail in databases registered in the names.nsf of the server.

you can do it both ways:

(slower)

get the directory, than the name of the given DB and take a look in the names.nsf, if the database is known under the view “Server/MailUsers”

(faster)

get all docs in the names.nsf view “Server/MailUsers”, read each mailfile name and go for it