Getting database

A warning on which DB to look for when sending mails using LotusScript and making the doc directly in

View member feedback to this tip.

When sending mails using LotusScript, most of us create the document directly in the database. In doing so, we usually look for the database "" There is a great threat with using, if we change the server configuration to use more than one, in which case the server will create,, etc. So it's always safer to check for a database in your script, and if it doesn't find one, then open

Function GetMailDb () As
 Dim Sess As New NotesSession
 Dim Db As notesdatabase
 Set Db = Sess.Currentdatabase
 Set GetMailDb = New notesdatabase 
( Db.Server, "Mail1.Box" )
 If Not GetMailDb.IsOpen Then
  Set GetMailDb = New notesdatabase 
( Db.Server, "Mail.Box" )
 End If
 If Not GetMailDb.IsOpen Then
  Set GetMailDb = Nothing
  Print "Unable to Mail Box.
 Could not send email."
 End If
End Function


This tip states: "Most of us create the document directly in the database."

I have never heard of anyone creating a document in Why would you need to? See the Send method in the help database. All you need to do is create a document in the current database and '.send.' It will not be saved in the database, just e-mailed.

-- Tony B.

Do you have comments on this tip? Let us know.

Dig Deeper on LotusScript



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury