运行 邮件文档,服务器 link 工作不正常

running mail doc, server link not working properly

问题:

  1. 使用代理运行并发送邮件给一个不同的link

  2. 邮件包含 link 不包含数据库

  3. 我设置它发送到雅虎邮箱

    Sub Initialize()
    Print"Agent:First Reminder for LateIn Reason started running at " & DateValue(Now()) & "," + TimeValue(Now())
    Dim ss As New NotesSession
    Dim db As NotesDatabase
    Dim LateInVw As NotesView
    Dim LateInDocs As NotesViewEntryCollection
    Dim LateEntry As NotesViewEntry
    Dim LateDoc As NotesDocument
    Dim StaffVw As NotesView, StaffDoc As NotesDocument
    Dim MailDoc As NotesDocument
    Dim rtBody As NotesRichTextItem
    Dim sysdoc As NotesDocument, sysVw As NotesView
    Dim AttVw As NotesView, Attdoc As NotesDocument
    
    Set db=ss.Currentdatabase
    
    Set sysVw=db.getview("($System Settings)")
    Set sysdoc=sysvw.getfirstdocument
    If sysdoc Is Nothing Then Exit Sub
    
    
    Set LateInVw=db.getview("(Testing Late-In Time Records)")
    
    
    Set StaffVw=db.getview("($Active Staff by ID)")
    
    Set AttVw = db.Getview("($Effective Attendance Setting By ID)")
    tdy=Datevalue(Now)
    
    'get all time records for today
    Set LateInDocs=LateInVw.Allentries
    Set lateEntry=LateInDocs.getfirstentry
    Do While Not LateEntry Is Nothing
        Set LateDoc=LateEntry.Document
        Set Attdoc=Attvw.Getdocumentbykey(LateDoc.TStaffID(0), True)
        If Attdoc.LateAtt(0)="Yes" Then
        If LateDoc.LateReason(0)=""  Then
            If Not ApprovedLateIn(LateDoc, LateDoc.TAmend(0), False) Then
            'get staff mail
                Set staffDoc=StaffVw.Getdocumentbykey(LateDoc.TStaffID(0), True)
                If Not staffdoc Is Nothing Then
                'send email with link to main menu
                    If email$<>staffDoc.email(0) Then
                    '   email$=staffDoc.email(0)
                        email$="chee111385@gmail.com"
                        Set Maildoc=New NotesDocument(db)
                        Set maildoc=db.Createdocument()
                        maildoc.Form="First Reminder Notification"
                        maildoc.Subject="Smartcard Attendance System: Late-In Notification for " +Format$(LateDoc.TDate(0),"dd/mm/yyyy")
                        Maildoc.StaffName=staffDoc.StaffName(0)
                        maildoc.Sendto="chee111385@gmail.com"
                    '   maildoc.NotifyDate=LateDoc.Tdate(0)
                        maildoc.NotifyTime=Timevalue(LateDoc.TAmend(0))
                        maildoc.NotesServer=sysdoc.ServerPath(0)
                        maildoc.NotesDBPath=sysdoc.DBPath(0)
                        maildoc.send(True)
                    End If
                End If
            End If 'check against unimas's jadual kedatangan
        End If 'check for late in reason
        End If 'check late-in on/off in attendance settings
        Set LateEntry=LateInDocs.Getnextentry(LateEntry)
    Loop
    
    
    End Sub
    

我会在这里附上我的图像文件和编码

从这 2 张图片你可以看到,实际上我想把它作为

注释://Mulu/SmartCard Attedancce/sas-server.nsf/Scais Main?OpenFrameset

但是邮件发出的结果是

notes:////Scais Main?OpenFrameset

其中没有服务器和数据库。我不确定我编码的哪一部分是错误的

另一个附件将是我用作 mail.form 的表格

首先:像您这样使用自定义表单发送外部邮件并不是最好的主意,因为目标系统可能无法相应地呈现所有内容。

就是说,我会先创建一个包含所有数据的文档,然后将其渲染到 maildoc。代码如下所示:

Dim Templatedoc as NotesDocument
Dim body as NotesRichtextItem

Set Templatedoc=New NotesDocument(db)
Set Templatedoc=db.Createdocument()
Templatedoc.Form="First Reminder Notification"
Templatedoc.StaffName=staffDoc.StaffName(0)
'   maildoc.NotifyDate=LateDoc.Tdate(0)
Templatedoc.NotifyTime=Timevalue(LateDoc.TAmend(0))
Templatedoc.NotesServer=sysdoc.ServerPath(0)
Templatedoc.NotesDBPath=sysdoc.DBPath(0)

Set maildoc=New NotesDocument(db)
maildoc.Form = "Memo"
maildoc.Subject="Smartcard Attendance System: Late-In Notification for " +Format$(LateDoc.TDate(0),"dd/mm/yyyy")
maildoc.Sendto="chee111385@gmail.com"

Set body = New NotesRichtextItem( maildoc, "Body" )
Call Templatedoc.RenderToRTItem( body )

maildoc.send(True)

其次:您设置了两个字段(NotesServer 和 NotesDBPath)来计算您的 Link。但实际上您的 link 是根据环境变量计算得出的,而这些变量并未在服务器上设置。

将您的 Link- 计算公式更改为:

srv := NotesServer;
pth := NotesDBPath;

这应该可以解决 link 的问题。