当前位置: 代码迷 >> Lotus >> u关于asp调用vb写的dll向lotus notes 发送邮件的有关问题,多谢
  详细解决方案

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

热度:115   发布时间:2016-05-05 06:58:49.0
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>



此问题已郁闷了一个月了,烦请各位高手不吝赐教,谢谢!
  相关解决方案