I would like to set up an auto reply agent to run when an employee receives email, to inform the sender that the person doesn’t work here anymore and to contact another employee.
I thought about modifying the OOO agent, but that seems incredibly hard to do without some help.
If I do alter the OOO agent, I though I can have an additional checkbox that when checked, changes the message that’s sent to say my own message.
' Initialise
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim docNext As NotesDocument
Dim view As NotesView
Dim rtitem As Variant
Dim collection As NotesDocumentCollection
Dim dateTime As New NotesDateTime( "01/01/2004" )
Set db = session.CurrentDatabase
' Process each new mail document
Set view = db.GetView( "($Inbox)" )
Set doc = view.GetFirstDocument
While Not ( doc Is Nothing )
Set docNext = view.GetNextDocument( doc )
If (doc.Form(0) = "Memo" Or doc.Form(0) = "Reply") Then
If doc.processed(0) <> "" Then
' do nothing - already processed
Else
' Incoming email
Set mailDoc = db.CreateDocument
Set rtitem = mailDoc.CreateRichTextItem("Body")
mailDoc.Subject = "Email Acknowledgement"
mailDoc.Principal = "email address"
mailDoc.Form = "Memo"
Set notesDocument = doc
Call rtitem.AppendText("Due to unforeseen circumstances, there will be no one available to answer technical queries via either e-mail or telephone. ")
Call mailDoc.Send(False, doc.From)
' Call doc.PutInFolder( "1. Processed Emails" )
doc.processed = Now
Call doc.save(True, True)
End If
End If
Set doc = docNext
Wend