2017-04-20 67 views
0

我想发送附件从莲花笔记的电子邮件。发送电子邮件从莲花笔记与附件使用asp.net c#

这个我试过下面的代码,它显示错误:

错误:

An exception of type 'System.Runtime.InteropServices.COMException' occurred in App_Web_sendemail.aspx.cdcab7d2.s2ysjl2c.dll but was not handled in user code 

Additional information: Database open failed (xx.xxx.xxx.xxx!!names.nsf) 

代码:

Domino.NotesSession nSession = new Domino.NotesSession(); 
     nSession.Initialize("bbau0862"); //Password 

     Domino.NotesDatabase nDatabase = 
    nSession.GetDatabase("xx.xxx.xxx.xxx", "names.nsf"); 

     //If the database is not already open then open it. 
     if (!nDatabase.IsOpen) 
     { 
      nDatabase.Open(); 
     } 

     Domino.NotesDocument nDocument = nDatabase.CreateDocument(); 
     /*create string variable that will be passed to function. This way we setup To field value*/ 
     string[] recipients = 
      {"[email protected]", "[email protected]"}; 

     //setup Form 
     nDocument.ReplaceItemValue("Form", "Memo"); 
     nDocument.ReplaceItemValue("SentTo", recipients); //To field 
     nDocument.ReplaceItemValue("Subject", "Message subject"); //message subject 
     nDocument.ReplaceItemValue("Body", "Something in the message body"); //set body text 
     nDocument.SaveMessageOnSend = true; //save message after it's sent 
     nDocument.Send(false, recipients); //send 

请告诉我如何发送Lotus Notes电子邮件与ASP附件。净。

谢谢。

回答

-1

它发生在我身上我发现这个错误,使用C#或PowerShell的Domino。 我想你尝试在64位应用程序中使用32位多米诺骨牌COM组合(64位不存在多米诺骨牌客户端)。 这意味着多米诺复合材料将在一个* 86 PowerShell控制台中工作,当它将此错误引发到64位PowerShell控制台。

解决方案恐怕是重新编译* 86的项目!

这里查看更多详细信息: Is a COMException of 0x80040154 always 'Class not registered'?

,所以我使用Domino COM你指出我的经验是非常bugy你最好有你的多米诺骨牌团队做出的用户信息web服务。

使用多米诺骨牌作为示例强制一切以x86运行。 ,并且在客户端应用程序中,COM将在您的用户的Lotus Notes Notes客户端(BOSS?)的同一时间在任何c#无关的错误kiling中崩溃。

+1

这不是错误,他得到了“数据库打开失败(xx.xxx.xxx.xxx !! names.nsf)”。如果代码加载失败,代码永远不会得到那么多。 –

2

您的代码无法打开数据库的names.nsf。在询问如何发送带有附件的电子邮件之前,您需要弄清楚为什么代码无法打开数据库。

对此的一些可能的解释是:您无法连接到服务器,您无法访问服务器,或者无法访问数据库。你需要检查所有这些东西。

在运行代码的机器上安装了哪些IBM Lotus代码? Notes客户端代码是否已安装或者是否安装了Domino服务器代码?一个或另一个必须是,如果它是服务器代码,则它必须是32位版本,因为IBM不支持Domino的64位COM类。

您需要检查代码是否可以连接到服务器'xx.xxx.xxx.xxx'。客户端和服务器都具有可用于检查的Trace功能。参见help for client trace)或help for server trace

您还需要检查当前用户标识(与密码“bbau0862”对应的密码文件名或服务器密钥文件名所指向的Initialize()方法中的哪一个(必须是当前标识) Notes客户机的notes.ini文件中的条目或 - 服务器上安装的Domino服务器的条目可以访问服务器'xx.xxx.xxx.xxx'和数据库'names.nsf'(如果它有权访问服务器,它应该可以访问names.nsf,但是如果它是某种特殊的ID,专门为您的应用程序提供的,那么您应该检查它们!这两个都很容易使用Notes客户端进行检查,并且那个ID