views:

62

answers:

3

Hi

Does Lotus notes client be running or opened in the background to send emails using Lotus Notes with .Net?

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. Should lotus notes client run on the background for my application to send emails? Is there any way that my application can send emails even if lotus notes client is not opened? I'm struck with this issue all day, did lot of research, but i could find anything.

i used this link as a base ref to send emails using .net http://www.ibm.com/developerworks/lotus/library/domino-msnet/

Any help regarding this is greatly appreciated.

A: 

Lotus Notes doesn't need to be opened or running, just installed on the same machine making the calls.

Instead of creating an email and sending it from a local database, you need to connect to a domino server's copy of a mail file, and send it from there. Sounds like you're close. Just switch the database you're connecting to and set it to the home server of the user you are logging in as.

Ken Pespisa
i am very new to lotus notes. i think you are right. Could you please tell me where can i find the domino server mail file? The following is the code that use to send mail oNotesSession = new NotesSession();oNotesSession.Initialize("******"); //passwordoNotesDatabase = oNotesSession.GetDatabase("", "names.nsf", false);if (!oNotesDatabase.IsOpen)oNotesDatabase.Open();
Naveen
names.nsf is the Domino Directory. You don't want to send email from there. Go to someone's desk (or your own) and open up Notes mail. Then click File > Database > Properties to see the location of that mail file. Your call to GetDatabase should include the server name, and file name, something like GetDatabase("SERVER/DOMAIN", "username.nsf");
Ken Pespisa
where is my earlier comment?
Naveen
hi ken, i am using the server vopy of the mail file. please check the code i'm using oNotesSession = new NotesSession(); oNotesSession.Initialize(pwd); string strDBFile = oNotesSession.GetEnvironmentString("MailFile", true); string strMailServer = oNotesSession.GetEnvironmentString("MailServer", true); oNotesDatabase = oNotesSession.GetDatabase(strMailServer, strDBFile, false); oNotesDatabase.Open(); oNotesDocument = oNotesDatabase.CreateDocument();
Naveen
The code appears to be correct. What is happening now?
Ken Pespisa
Hi Ken, the mail is not being sent. it is sent only if the lotus notes client is running in the background. i dont understand what i am missing.. pls help
Naveen
If you're not getting an error, then I have to assume you're still sending emails that are sitting in the mail.box on the local machine. Perhaps set your Notes location to Island temporarily, then run your code, and then check the mail.box file in Notes (File > Database > Open > mail.box) See if your email shows up there.
Ken Pespisa
Another thought is try hard-coding the server name and mail file name. Also, you might try just creating a document and saving it (not sending). Then it should show up in the database in one of the views (all documents, if it is a mail file) At that point you'd at least know the code is working and affecting the correct database. That's something we can build from.
Ken Pespisa
hi ken, now i'm using oNotesSession.GetDatabase(strMailServer, "mail.box", false); someone suggested to use "mail.box" instead of username.nsf. but still no luck. no exceptions thrown. code is perfectly running fine. BTW, i dont see File > Database on my Notes. Are there any setting that i need to change to see the dataase
Naveen
ken, maybe u r right, i just switched my location to "Offiline" from "Online" and ran my code. oNotesSession.GetDatabase(strMailServer, strDBFile, false); returned null. So it is still interacting with the local lotus notes client. i thought oNotesSession.GetEnvironmentString("MailServer", true); would return the right mail server. Now how do i get right mail server?
Naveen
You should be able to find your home mail server name - I can't help you with that. Try hardcoding the mail server name and the mail database name into that GetDatabase call.
Ken Pespisa
A: 

Note that if you want to, you can create a message directly in mail.box (the server's mail router mailbox) instead of needing to use a specific person's mail file.

Ross Hawkins
A: 

From the description of your problem, it appears that you are operating with a local replica of your mail database in your current location. That means that when you create the mail document, you are creating it on your local machine, and without Notes up and running, replication with the server will not take place automatically. Your mail is then sent to your outgoing mailbox (mail.box on Local) until you connect to the server. In order to send the mail through the Notes system immediately, you would need to use the server replica of your mail database (or as Ross pointed out, create the message directly in the server mailbox -- which is not exactly good practice).

To use the server, you would need to modify your code to check the mail server string you are fetching. If it's an empty string, you will need to go looking for your actual mail server and database path in the Domino Directory. (Note: you can also open the database on the server using the replica id, which will be the same as the replica id of your local mail database.) The mail server name and mail file path will be recorded on your Person document, which you can access using your user name as a lookup key in the ($VIMPeople) view. The hard part will be determining which server to go to. You may be able to get it reliably from a Location or Connection document in your local address book, but that depends on how many environments you operate in. If you're in a single environment, then you should be able to rely on Office.

Stan Rogers