This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
RE: Agent set on "After mail arrives" never triggers ~Vera Minatexettu 25.Jul.03 07:36 PM a Web browser Applications Development All ReleasesWindows 2000
Many thanks to your help. I got the "After new mails arrive" working . The "Before" is not working but that is good enough for now . Here is my code for the "After" :
*********************************
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc1 As NotesDocument 'incoming mail
Dim reply As NotesDocument
'Dim searchStr As String
'Dim searchDate As New NotesDateTime("07/05/56")
Dim dc As NotesDocumentCollection
'Dim vc As NotesViewEntryCollection
Dim view As NotesView
Dim entry As NotesViewEntry
Dim nav As NotesViewNavigator
Set db = session.CurrentDatabase
Set dc = db.UnprocessedDocuments
'Search for mail with word PMMA in the subject
Dim Subject As String, SearchforString As String
Dim positionOfChar As Long
Dim positionOfCharCase As Long
Dim found As Variant
If dc.Count >0 Then
For i = 1 To dc.Count
Set doc1 = dc.GetNthDocument(i)
found = False
Subject =doc1.Subject(0)
SearchforString = "PMMA Request"
positionOfChar& = Instr(Subject$ , SearchforString$ )
'If found occurence of word PMMA in the subject line
If positionOfChar& <> 0 Then
Set view = db.GetView("($Drafts)") 'View that store the draft reply
Set nav = view.CreateViewNav
Set entry = nav.GetFirst
While Not(entry Is Nothing ) And Not found
Set reply = entry.Document 'Search for the draft
If reply.Subject(0) = "Getting Started with PMMA" Then
reply.Form = "Memo"
reply.SendTo = doc1.From
reply.Send(True)
found =True
Else
Set entry = nav.GetNext(entry)
End If
Wend
End If
Next
End If
End Sub