欢迎来到Doc100.Net免费学习资源知识分享平台!
您的位置:首页 > 程序异常 >

u关于asp调用vb写的dll向lotus notes 发送邮件的有关问题,多谢

更新时间: 2014-01-05 03:01:51 责任编辑: Author_N1

 

u关于asp调用vb写的dll向lotus notes 发送邮件的问题,谢谢!
我用vb编写asplotusnotes.dll,也注册了,在asp中调用始终不成功,不知为什么?请高手帮忙指出错在哪?,谢谢!

以下是asplotusnotes.dll代码,在vb中调用正常通过。
Private MyScriptingContext As ScriptingContext
Private MyApplication As Application
Private MyRequest As Request
Private MyResponse As Response
Private MyServer As Server
Private MySession As Session
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set MyScriptingContext = PassedScriptingContext
Set MyApplication = MyScriptingContext.Application
Set MyRequest = MyScriptingContext.Request
Set MyResponse = MyScriptingContext.Response
Set MyServer = MyScriptingContext.Server
Set MySession = MyScriptingContext.Session
End Sub
Public Sub OnEndPage()
Set MyScriptingContext = Nothing
Set MyApplication = Nothing
Set MyRequest = Nothing
Set MyResponse = Nothing
Set MyServer = Nothing
Set MySession = Nothing
End Sub


Public Sub SendMail(strMailDbName1 As String, cSubject As String, cstrAttachment As String, cRecipient As String, cCopyToRec As String, cBodyText As String)
Dim oSession ' AS NotesSession

  Dim strServer

  Dim strUserName
  Dim strMailDbName
  Dim oCurrentMailDb  

  Dim oMailDoc  

  Dim ortItem  

  Dim ortAttacment  

  Dim oEmbedObject  

  Set oSession = CreateObject("Notes.NotesSession")

  strServer = oSession.GetEnvironmentString("MailServer", True)

  strUserName = oSession.UserName
  strMailDbName = Trim(strMailDbName1)
  Set oCurrentMailDb = oSession.CurrentDatabase

  If oCurrentMailDb.IsOpen = True Then

  Else
  oCurrentMailDb.OPENMAIL

  End If

  Set oMailDoc = oCurrentMailDb.CREATEDOCUMENT

  oMailDoc.Form = "Memo"

  With oMailDoc

  .SendTo = Trim(cRecipient) '收件人

  '.BlindCopyTo = cRecipient

  .CopyTo = Trim(cCopyToRec) '抄送

  .Subject = Trim(cSubject) '邮件标题

  .Body = Trim(cBodyText) '&&邮件内容
   

  End With

If Len(Trim(cstrAttachment)) <> 0 Then
  Set ortAttacment = oMailDoc.CREATERICHTEXTITEM("Attachment")
  Set oEmbedObject = ortAttacment.EMBEDOBJECT(1454, "", cstrAttachment, "Attachment")
End If

  With oMailDoc

  .PostedDate = Now()

  .SAVEMESSAGEONSEND = "True"

  .send (False)

  End With

  Set oMailDoc = Nothing

  Set oCurrentMailDb = Nothing

  Set oSession = Nothing

End Sub

’在vb中调用测试的代码,通过没问题!
'Private Sub Command1_Click()
 'SendMail "C:\Lotus\Notes\Data\as_计划财会部.nsf", "我的测试邮件标题", "", "计划财会部/邯郸/河北/boc", "", "我的测试邮件内容"
'End Sub

'以下是a.asp的代码,调用不能通过,提示错误类型:
’asplotusnotes (0x80070002)
'Automation 错误
'/LotusNotes.asp, 第 12 行


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 23</title>
</head>

<body>
<%
dim MyTestObj
Set MyTestObj = Server.CreateObject("asplotusnotes.asplotusnotesl")
MyTestObj.SendMail "C:\Lotus\Notes\Data\as_计划财会部.nsf","我的测试邮件标题","F:\kk\c.xls","计划财会部/邯郸/河北/boc","计划财会部/邯郸/河北/boc","我的测试邮件内容"
Set MyTestObj = Nothing
%></body>
&nbsp;</html>



此问题已郁闷了一个月了,烦请各位高手不吝赐教,谢谢!
上一篇:上一篇
下一篇:下一篇

 

随机推荐程序问答结果

 

 

如对文章有任何疑问请提交到问题反馈,或者您对内容不满意,请您反馈给我们DOC100.NET论坛发贴求解。
DOC100.NET资源网,机器学习分类整理更新日期::2014-01-05 03:01:51
如需转载,请注明文章出处和来源网址:http://www.doc100.net/bugs/t/17544/
本文WWW.DOC100.NET DOC100.NET版权所有。