Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获得;“数据库打开失败”;使用.NET通过lotus notes发送电子邮件时出现异常_.net_Lotus Notes - Fatal编程技术网

获得;“数据库打开失败”;使用.NET通过lotus notes发送电子邮件时出现异常

获得;“数据库打开失败”;使用.NET通过lotus notes发送电子邮件时出现异常,.net,lotus-notes,.net,Lotus Notes,我正在处理一项任务,我的.net应用程序应该使用Lotus Notes客户端(而不是SMTP)和使用Dominos.dll的.net发送电子邮件。我也能发邮件。但是当我关闭lotusnotes邮件客户端并尝试运行不发送邮件的应用程序时,问题就出现了。原因是,我认为它们被储存在“发送邮件”中。再次,当我通过输入用户名和密码重新打开LotusNotes客户机时,“Outgoing mail”中的邮件已发送。 一位女士建议我连接本地副本以发送电子邮件,并告诉我将数据库名称更改为服务器数据库文件。我更改

我正在处理一项任务,我的.net应用程序应该使用Lotus Notes客户端(而不是SMTP)和使用Dominos.dll的.net发送电子邮件。我也能发邮件。但是当我关闭lotusnotes邮件客户端并尝试运行不发送邮件的应用程序时,问题就出现了。原因是,我认为它们被储存在“发送邮件”中。再次,当我通过输入用户名和密码重新打开LotusNotes客户机时,“Outgoing mail”中的邮件已发送。 一位女士建议我连接本地副本以发送电子邮件,并告诉我将数据库名称更改为服务器数据库文件。我更改了到服务器的连接,现在我得到了这个错误“数据库打开失败”。有趣的是,如果我使用“names.nsf”文件,我不会得到异常。但是,如果我更改为我的“username.nsf”,它将无法连接,并给我这个错误。但如果我使用“names.nsf”文件,当我关闭LotusNotes并运行我的应用程序时,邮件将无法送达

下面是我用来发送电子邮件的代码

    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);

请确保您可以通过.NET使用相同的登录名打开相同的数据库。换句话说,只需打开Notes客户端并尝试在服务器上打开username.nsf文件。很可能您没有该服务器的权限

你肯定不想从names.nsf发送电子邮件(但理论上它仍然有效)

顺便说一句,在调用oNotesDatabase.Open()之后;您需要创建Notes文档:

oNotesDocument = oNotesDatabase.CreateDocument();