I am working on a task where my .net application should send emails using Lotus Notes client ( NOT SMTP) with .NET using Dominos.dll. I am able to send mails also. But the problem comes when i close my Lotus Notes mail client and try to run my application which does not deliver mails. Reason, i think they were being stored in "Outgoing mail". Again when i re-open my Lotus Notes client by entering my username and password, then the mails that were in "Outgoing mail" were been delivered. One gentleman over her suggested me that i am connecting to my local copy to send email and told me to change my database name to the servers database file . I changed the connection to server Now i am getting this error "Database open failed." Interesting thing is if i am using "names.nsf" file, i am not getting exception. But if i change to my "username.nsf" it could not connect and gives me this error. But if i use "names.nsf" file, mails are not getting delivered when i close lotus notes and run my app.
The following is the code that i used to send email.
oNotesSession = new NotesSession();
oNotesSession.Initialize("******"); //password
oNotesDatabase = oNotesSession.GetDatabase("servername", "names.nsf", false);
if (!oNotesDatabase.IsOpen)
oNotesDatabase.Open();
oNotesDocument.ReplaceItemValue("Form", "Memo");
oNotesDocument.ReplaceItemValue("SendTo", strToAddress);
oNotesDocument.ReplaceItemValue("body", mData.Body);
oNotesDocument.ReplaceItemValue("Subject", mData.Subject);
oNotesDocument.ReplaceItemValue("$KeepPrivate", "1");
oNotesDocument.ReplaceItemValue("postDate", DateTime.Now.ToShortDateString());
oItemValue = oNotesDocument.GetItemValue("SendTo");
oNotesDocument.Send(false, ref oItemValue);