Thursday, March 20, 2014

Getting mail.box from Domino server

Domino allows to setup up to 10 mail boxes for 1 server. By default it 1 mail box with name mail.box however if you increase number of mail boxes to 2 and more Domino will create mail1.box, mail2.box ... and you must remember about it.
In order to get mail box without doing lookup to ServerConfig document, just try to initiate mail1.box first and if it does not exists go for mail.box
public Database getMailBox(Session session) throws NotesException{
 String server = session.getServerName();
 Database mailbox = session.getDatabase(server, "mail1.box");
 if (!mailbox.isOpen()) {
  mailbox = session.getDatabase(server, "mail.box");
 }
 return mailbox;
}
There is topic on how to force Domino to use mail.box when multiple mail.boxes are enabled

4 comments :

Anonymous said...

Actually... you can always look for "mail.box" on the server. If it does not exist, you will automatically get a handle to mail1.box, or mail2.box, or mail3.box... etc. It is random. --Brian

Dmytro said...

hm, odd, case you described did not work for me, but will do double check.

richard fenwick said...

You may need to add a line to the servers notes.ini http://www-01.ibm.com/support/docview.wss?uid=swg21197976

Dmytro said...

Hey Richard, thanks for link, I did not know that.