July 27, 2007

About mail.box

Sometimes it is desirable to put mail messages directly into the mail box on the server. If the server has one mail box it is called mail.box. But as you might know it is possible to create several mail boxes to increase performance if lots of mail are running through the system. Be cautious here though, 18 mail boxes is not a good alternative but 2, 3 or 4 might really help. Anyway, when telling the server to create several mail boxes the database mail.box will disappear and instead new mail boxes will be created called mail1.box, mail2.box and so on.

Now, if your application wants to create a mail in mail.box based on some form you probably would like to hard code the name of the database, that is mail.box. But what if the server has several mail boxes? No worries, don't change a thing. You still type mail.box and the server/router will put the mail in the mail box which is mostly available at the time.

It might be good to know that this is not supported officially though.

Here's where you change how many mail boxes to use. The command "Tell Router Update Config" should make the changes take effect immediately or you could just wait 5 minutes.



And here's a code strip as an example of how to put mail directly in mail.box.

Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim serverName As String
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim rtitemA As NotesRichTextItem
Dim rtitemB As NotesRichTextItem

Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument

serverName = db.Server
Dim mailBoxDb As New NotesDatabase(serverName, "mail.box")
Dim mailDoc As NotesDocument
Set doc = uidoc.Document

Set mailDoc = New NotesDocument(mailBoxDb)
Call mailDoc.AppendItemValue("Form", "Memo")
Call mailDoc.AppendItemValue("From", uidoc.FieldGetText("From"))
Call mailDoc.AppendItemValue("SendFrom", uidoc.FieldGetText("From"))
Call mailDoc.AppendItemValue("Principal", uidoc.FieldGetText("Principal"))
Call mailDoc.AppendItemValue("SendTo", uidoc.FieldGetText("SendTo"))
Call mailDoc.AppendItemValue("Recipients", uidoc.FieldGetText("SendTo"))
Call mailDoc.AppendItemValue("ReplyTo", uidoc.FieldGetText("ReplyTo"))'
Call mailDoc.AppendItemValue("Subject", uidoc.FieldGetText("Subject"))

Set rtitemA = New notesrichtextitem(mailDoc, "Body")
Set rtitemB = doc.GetFirstItem("messageBody")

Call rtitemA.AddNewline(1)
Call rtItemA.AppendRTItem(rtitemB)

Call mailDoc.Save(True, False)



Technorati tags:
, ,


No comments: