Hi all,
I have a problem with the Autoreply agent created in a mailbox.
The agent was created long ago and was working fine until recently it's stopped.
The agent should be running after a new mail arrived.
But now even I create a new agent, it just doesn't run at all.
When I tried to run it manually, then it sends the message out.
My user has "Manager" access and with all rights to this mailbox. And he has the rights to run the "restricted LotusScript/Java agents" on server too.
Anything I missed out? Can someone enlighten me?
Thanks very much in advance.
Here is my coding.
==========================
==========
==========
==========
========
Sub Initialize
Dim sess As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument, maildoc As NotesDocument
Dim itmAutoR As NotesItem
Dim mailbody As NotesRichTextItem, bodyOrig As NotesRichTextItem
Dim i As Integer
On Error Goto ErrHandler
Set db = sess.CurrentDatabase
Set dc = db.UnprocessedDocuments
For i = 1 To dc.Count
Set doc = dc.GetNthDocument(i)
If doc.HasItem("AutoReply") Then
'do nothing
Else
If Trim(doc.From(0)) = "etravel@abc.com" _
Or Trim(doc.From(0)) = "CN=eTravel/OU=Users/O=ABC
_Holdings"
_
Or Ucase(Trim(doc.From(0))) Like "*WEBADMIN*" Then
'do nothing
Else
Set bodyOrig = doc.GetFirstItem("Body")
Set itmAutoR = New NotesItem(doc, "AutoReply", "Y")
Call doc.Save(True, False)
Set maildoc = New NotesDocument(db)
maildoc.Form = "Memo"
maildoc.SendTo = doc.From(0)
maildoc.CopyTo = "oacgi/Users/ABC_Holdings"
maildoc.SMTPOriginator = "eTravel@abc.com"
maildoc.From = "eTravel@abc.com"
maildoc.Principal = "eTravel"
maildoc.InternetAddress = "eTravel@abc.com"
maildoc.Subject = doc.Subject(0)
Set mailbody = New NotesRichTextItem(maildoc,
"Body")
Call mailbody.AddNewLine(3)
Call mailbody.Appendtext("***TH
IS IS AN AUTOMATICALLY GENERATED ACKNOWLEDGEMENT***")
Call mailbody.AddNewLine(3)
Call mailbody.Appendtext("Thank
you for your email.")
Call mailbody.AddNewLine(2)
Call mailbody.Appendtext("Your query is important to us. We strive to respond to your queries within 2 working days.")
Call mailbody.AddNewLine(2)
Call mailbody.Appendtext("Your receipt of this automated response confirms that your email has been received. It is therefore not necessary to send it to us again.")
Call mailbody.AddNewLine(2)
Call mailbody.Appendtext("Our working hours are Monday - Friday, 9:00am to 5:00pm. We will be happy to assist you.")
Call mailbody.AddNewLine(3)
Call mailbody.Appendtext("Regar
ds")
Call mailbody.AddNewLine(2)
Call mailbody.Appendtext("Etrav
el Admin")
Call mailbody.AddNewLine(1)
Call mailbody.Appendtext("-----
----------
----------
----------
----------
----------
----------
----------
")
Call mailbody.AddNewLine(2)
Call mailbody.AppendRTItem(body
Orig)
maildoc.PostedDate = Now
Call maildoc.send(True)
Call maildoc.Save(True, False)
Set maildoc = Nothing
End If
End If
Next
Exit Sub
ErrHandler:
Print "AutoReply-eTravel : Error at line " + Cstr(Erl) + " - " + Error$
Exit Sub
End Sub
Start Free Trial