2017-06-16 48 views
0

問題:運行郵件文檔,服務器的鏈接不能正常工作

  1. 使用代理運行併發送郵件給不同的鏈接

  2. 郵件內的連結不包括數據庫

  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$="[email protected]" 
            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="[email protected]" 
           ' 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 
    

我會附上我的圖片文件和編碼這裏

wrong path come out from mail

correct path

從這個2圖像可以看到,實際上我想提出一個

筆記:// Mulu/SmartCard Attedancce/sas-server.nsf/Scais Main?OpenFrameset

但發送郵件的結果是

說明://// Scais Main?OpenFrameset

這是沒有服務器和數據庫。我不知道我的編碼的一部分是錯誤的

另一個附件將是我作爲mail.form Form

hotspot link include script

回答

2

首先都使用形式:發送外部郵件與自定義表單像你這樣做不是最好的想法,因爲目標系統可能無法相應地渲染所有東西。

這就是說,我將首先創建一個包含所有數據的文檔,然後將其渲染爲一個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="[email protected]" 

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

maildoc.send(True) 

第二:您設置了兩個字段(NotesServer和NotesDBPath)來計算您的鏈接。但是,實際中的鏈接是從環境變量計算出來的,並且這些不在服務器上設置。

您的鏈結Computation-公式更改爲:

srv := NotesServer; 
pth := NotesDBPath; 

這應該做的鏈接的伎倆。

+0

好的,你建議的鏈接已經正常工作......這是正確的..但它仍然不允許我打開框架本身......它仍然會去「查看」其中包含的數據是。 「LateInVw」。我只是把這個觀點循環到誰遲到了,並且強迫他們去框架集以輸入晚〜的原因 –