1

I send mails from C# code via Lotus Notes and it works really fine - with Win7 and WinXP.

But some users of my program have multiple .nsf files in the directory, like 'user1.nsf' and 'old-user1.nsf'.

How can I retieve which of these files is the active database I have to use?

Martin S
  • 31
  • 4

3 Answers3

3

If your code runs on users machine then you have "MailFile" and "MailServer" variables in notes.ini file.

Where is this directory located?

  • Yes, thank you! I found it. And I read it with following code: ' Type NotesSession = Type.GetTypeFromProgID("Notes.NotesSession"); Object sess = Activator.CreateInstance(NotesSession); String mailFile = (String)NotesSession.InvokeMember( "GetEnvironmentString", BindingFlags.InvokeMethod, null, sess, new Object[] { "MailFile", true }); ' – Martin S Mar 01 '13 at 13:28
1

You don't need to care which mail database is active if you are sending emails. Just create a new NotesDocument object in memory, fill out the appropriate properties (subject, Body, etc), and then call the Send method on that object. Notes takes care of the rest.

If you need to get the mail database information for a user for another reason, there is a GetUserInfo method for that on the NotesRegistration class

Or in formulas, there is the @MailDbName formula.

Ken Pespisa
  • 21,989
  • 3
  • 55
  • 63
0

If you're just using the user's mail file, in LotusScript you can just use

Call notesDatabase.OpenMail

That way, you never need to bother with where the mail file is - you get the handle to it seemlessly.

David Navarre
  • 1,022
  • 10
  • 27