C# 使用asp.net c从lotus notes发送带有附件的电子邮件#
我想从lotus notes发送带有附件的电子邮件 我尝试了以下代码,它显示错误: 错误:C# 使用asp.net c从lotus notes发送带有附件的电子邮件#,c#,asp.net,email,lotus-notes,lotus-domino,C#,Asp.net,Email,Lotus Notes,Lotus Domino,我想从lotus notes发送带有附件的电子邮件 我尝试了以下代码,它显示错误: 错误: 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 (
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)
代码:
请告诉我如何在asp.net中发送带有附件的lotus notes电子邮件
谢谢。我碰巧在使用c#或powershell的Domino中遇到了这个错误。 我认为您可以尝试在64位应用程序中使用32位domino COM组件(对于domino客户端,64位组件不存在)。 这意味着当domino composant在64位powershell控制台中抛出此错误时,它将在*86 powershell控制台中工作 解决方案恐怕是重新编译*86的项目 查看此处了解更多详细信息: 因此,我在我的经验中指出,使用DominoCOM是非常错误的,您最好让您的domino团队制作一个用户信息的Web服务 以domino为例,强制一切以x86运行。
在客户端应用程序中,COM将在用户的lotus notes客户端(BOSS?)同时发生任何意外错误时崩溃。您的代码无法打开数据库“names.nsf”。在询问如何发送带有附件的电子邮件之前,您需要找出代码无法打开数据库的原因 对此的一些可能解释是:无法连接到服务器,无法访问服务器,或者无法访问数据库。你需要检查所有这些东西 运行代码的机器上安装了什么IBM Lotus代码?是安装了Notes客户端代码还是安装了Domino服务器代码?其中一个必须是,如果是服务器代码,则必须是32位版本,因为IBM不支持用于Domino的64位COM类 您需要检查代码是否可以连接到服务器“xx.xxx.xxx.xxx”。客户端和服务器都有跟踪功能,您可以使用这些功能来检查这一点。见)或 您还需要检查当前用户id(与要传递到
Initialize()中的密码“bbau0862”相对应的id)是否正确
方法,并且必须是当前id(由上notes客户端或Domino服务器安装的notes.ini文件中的keyfilename或serverkeyfilename项指向),可以访问服务器“xx.xxx.xxx.xxx”和数据库“names.nsf”。(如果它可以访问服务器,它应该可以访问names.nsf,但是如果它是专门为您的应用程序提供的某种“特殊”id,您真的应该检查!使用Notes客户端和该id可以轻松检查这两个id。这不是错误。他得到了“数据库打开失败(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 =
{"abc@gmail.com", "xyz@gmail.com"};
//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