Hello I have done some work for the C++ API and I get the error message “File Does Not Exist” when trying to send emails. “Save()” works but “Send()” OR “SendTo()” do not…Below is a snippet for more details. Any assistance is appreciated.
LNSetThrowAllErrors(TRUE);
LNNotesSession Session;
LNMailMessage mail;
LNItem bodyitem;
try
{
if(Session.Init())
MessageBox(NULL,"Unable to initialize session.","Error",MB_OK);
Session.CreateMailMessage(&mail);
mail.SetRecipients("someone@someone.ca");
mail.SetDeliveryPriority(LNDELIVERYPRIORITY_NORMAL);
mail.SetMailImportance(LNMAILIMPORTANCE_NORMAL);
mail.SetDeliveryReport(LNDELIVERYREPORT_ON_FAILURE);
mail.SetSubject("Subject");
mail.SetCC("somebody@someplace.ca");
LNRichText body;
if(mail.GetBody(&body))
MessageBox(NULL,"No body","ERROR",MB_OK);
else
body.SetValue("Hello This is successful.");
mail.Send();
//mail.Save();
Subject: “File Does Not Exist”, C++ API
Hi Terence,
I’m on the C++ development team, Please reply back to this forum:
Your code works fine…some poor person at “somebody@someplace.ca” is going to get this message
“Hello This is successful.”
…
Question 1)
What version of the toolkit are you using? I tried this on Windows 2000 running Notes 6.0.1 with the C++ API 2.3
Question 2)
Is the environment setup correctly? i.e. location docs, etc. Can the user easily send out an email via the UI?
…
I used the following code
…
#include <windows.h>
#include <iostream.h>
#include <lncppapi.h>
const int ERR_BUF_SIZE=512+1;
char buffer[ERR_BUF_SIZE]=“”;
int main (int argc,char *argv)
{
cout << "Testing "<<endl;
LNSetThrowAllErrors(TRUE);
LNNotesSession Session;
LNMailMessage mail;
LNItem bodyitem;
try
{
if(Session.Init())
MessageBox(NULL,"Unable to initialize session.","Error",MB_OK);
Session.CreateMailMessage(&mail);
mail.SetRecipients("steve_chin@us.ibm.com");
mail.SetDeliveryPriority(LNDELIVERYPRIORITY_NORMAL);
mail.SetMailImportance(LNMAILIMPORTANCE_NORMAL);
mail.SetDeliveryReport(LNDELIVERYREPORT_ON_FAILURE);
mail.SetSubject("Subject");
mail.SetCC("steve_chin@us.ibm.com");
LNRichText body;
if(mail.GetBody(&body))
MessageBox(NULL,"No body","ERROR",MB_OK);
else
body.SetValue("Hello This is successful.");
mail.Send();
//mail.Save();
}
catch (LNSTATUS status)
{
LNGetErrorMessage(status, buffer, ERR_BUF_SIZE);
cout <<buffer<<endl;
}
return 0;
}
Subject: RE: “File Does Not Exist”, C++ API
Hello Steve,
Answer 1) I am running notes 6.0.1 with C++ API 2.3 but on windows NT4 (SP6)
Answer 2) It does not return LNERR_NO_MAIL_DATABASE, and all the settings mentioned in Relnotes.txt appear to be valid
what I am doing is this:
I am using the AddInmenu feature and within the dll for AddInMenu,I attempt to send the email when NAMM_COMMAND is passed in.
Like I said before, it saves fine, just doesn’t send…I’m new to dlls and lotus so I’m pretty lost…
Thanks,
Terence
Subject: RE: “File Does Not Exist”, C++ API
hmm,I haven’t used the toolkit in this manner, I’m wondering if the C++ initialization is not picking up the right context.
If C API’s don’t need a NotesInitExtended (I’m not a expert in this area…menu addins), try
if(Session.Init(FALSE))
This will Initialize only the C++ api’s memory manager, but not the Notes Session. Post your results…
Subject: RE: “File Does Not Exist”, C++ API
Steve,I have created an exe instead of dll and tried running the code outside of notes(no addinmenus)
To be sure, I used only the code you re-posted and I got the same error…“File does not exist”
Lotus must be improperly configured or something…any ideas?
I’ll start combing the forums again…
Terence
Subject: RE: “File Does Not Exist”, C++ API
Email sends fine…Do ALL of the location docs have to be set up properly? Which does lotus default to(if any) when send() is called?
Terence
Subject: RE: “File Does Not Exist”, C++ API
Yes they should be setup correctly!
For UI Addins I believe the current location doc is used and the id must match.
For standalone executables you can have specific notes.ini’s (again you need the correct location documents).
Try creating the location docs (make sure to have the location doc point to the right id), switch over to the new location document. Close Notes…rename notes.ini to something userfule (i.e. user1.ini) and load that with LNNotesSession.Init…(please refer to the documentation)