Send Pager Alert Agent

The Send Pager Alert Agent will automatically send a page via Internet pager address(s). The agent is triggered on new mail delivery. When a new message comes in that is flagged important &/or high priority, the agent create a new memo & send to the Send To(s) specified.

CAVEAT: If the person's NAB document has the Mics. setting "Encrypt incoming mail" to "Yes", this agent can not read the rich text field. (This is working as designed, according to Lotus.)


 'Send Pager Alert Agent (LS): 

Option Public
Option Declare

Sub Initialize
     Dim session As New NotesSession
     Dim dbCurrent As NotesDatabase
     Dim collUnprocessed As NotesDocumentCollection
     Dim docCurrent As NotesDocument
     Dim itemBody As NotesItem
     Dim strPriority As String, strImportance As String
     Dim varBody As Variant
     Dim strSendTo(1) As String
     strSendTo(0) = "6109999999.0505245@PAGENET.NET"   'Pager Internet Address
     strSendTo(1) = "2155551212@msg.celluar.com"       'Celluar pager address
     
     Set dbCurrent = session.CurrentDatabase
     If (dbCurrent Is Nothing) Then
          Print "dbCurrent not set"
     Else
          Set collUnprocessed = dbCurrent.UnprocessedDocuments
          If collUnprocessed.Count < 1 Then
               Print "Nothing to process"
          Else
               Set docCurrent = collUnprocessed.GetFirstDocument
               If (docCurrent Is Nothing) Then
                    Print "Could not get handle of current document"
               Else
                    Do
                         strPriority = docCurrent.DeliveryPriority(0)
                         strImportance = docCurrent.Importance(0)
                         If ((docCurrent.Form(0) = "Memo") And (strPriority = "H" Or strImportance = "1")) Then
                             'Need to create new memo & send to pager.
                              Dim docPagerMemo As New NotesDocument(dbCurrent)
                              Dim varFrom As Variant, strSubject As String, strBodyText As String
                              Stop 'use for debugging
                              docPagerMemo.SendTo = strSendTo
                              varFrom = Evaluate({@Name([CN]; From)}, docCurrent)
                              strSubject = docCurrent.Subject(0)
                              Set itemBody = docCurrent.GetFirstItem("Body")
                              If (itemBody Is Nothing) Then
                                   'Body can not be read
                                   Print "itemBody not set"
                                   docPagerMemo.Body = "Text can not be read. Check your email. | From: " & varFrom
                              Else
                                   'If Body can be read, return only 200 characters
                                   'break down variables for debugging
                                   strBodyText = "From: " & varFrom(0) & " : " & strSubject & " - " & Left(itemBody.Text, 200)
                                   docPagerMemo.Body = strBodyText
                              End If
                              Call docPagerMemo.Send(False)
                              Print "Page sent"
                              
                              Call session.UpdateProcessedDoc(docCurrent)
                         End If
                         Set docCurrent = collUnprocessed.GetNextDocument(docCurrent)
                    Loop Until (docCurrent Is Nothing)
               End If
          End If
     End If
End Sub
This was first published in February 2001
This Content Component encountered an error

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close