Tip

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.