IBM Notes - 创建代理以在用户输入日期发送邮件

时间:2018-05-16 00:33:36

标签: lotus-notes lotus-domino lotusscript

我创建了一个表单,其中包含一个向用户发送邮件通知的按钮。我需要一个预定的代理在用户输入日期发送邮件。谢谢。

以下是按钮的代码:

Sub Click(Source As Button)
    Dim incharge As String
    Dim Session As New NotesSession
    Dim db As NotesDatabase
    Set db = session.CurrentDatabase
    Dim ws As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument
    Dim doc As NotesDocument
    Dim varValues As Variant
    Dim varCC As Variant

    Set uidoc = ws.currentDocument
    Set doc = uidoc.Document
    varCC = "(the CC address)"
    varValues = doc.GetItemValue( "incharge" )
    Dim email As NotesDocument
    Set email = db.CreateDocument
    email.Form="project"
    email.Principal="(the sender address)"
    email.Subject="(subject)"
    email.CopyTo=  varCC
    If Not Isnull( Arraygetindex( varValues, "Employee 1" ) ) Then
    email.Body = "Message"
    email.SendTo = "Employee 1 Address"
    Call email.Send(False)
    Else
    End If
    If Not Isnull( Arraygetindex( varValues, "Employee 2" ) ) Then
        email.Body = "Message"
        email.SendTo = "Employee 2 Address"
        Call email.Send(False)
    Else
    End If
    If Not Isnull( Arraygetindex( varValues, "Employee 3" ) ) Then
        email.Body = "Message"
        email.SendTo = "Employee 3 Address"
        Call email.Send(False)
    Else
    End If
    If Not Isnull( Arraygetindex( varValues, "Employee 4" ) ) Then
        email.Body = "Message"
        email.SendTo = "Employee 4 Address"
        Call email.Send(False)
    Else
    End If
    If Not Isnull( Arraygetindex( varValues, "Employee 5" ) ) Then
        email.Body = "Message"
        email.SendTo = "Employee 5 Address"
        Call email.Send(False)
    Else
    End If
    If Not Isnull( Arraygetindex( varValues, "Employee 6" ) ) Then
        email.Body = "Message"
        email.SendTo = "Employee 6 Address"
        Call email.Send(False)
    Else
    End If
End Sub

此代码在单击按钮后发送邮件。谢谢!

1 个答案:

答案 0 :(得分:1)

单击按钮时,只需保存文档。然后创建一个每天运行一次的预定代理,并使用当前日期执行db.search()查找“项目”文档,遍历集合并发送它们。

这是一种方式,还有很多其他方式。