developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum


email not sending through schedule agent
db sh 09/17/2014 09:04 AM
Applications Development All Releases All Platforms

Dear All,
I have created one agent for reminder, I have tested my code on three different servers, my code is working perfectly fine in 2 servers but at one server agent is running, updating the fields also but not getting any email through this agent although same agent code working on other server and getting email also.

My requirement is there is one creation date field, which is set when user creates document for ex 17.03.2014 user created document then after 6th month means 17-09-2014 reminder email will be sent and creation date field will updated by current date(means 17-09-2014 will set in creation date field) and again after 6th month means 17-03-2015 reminder email will go and so on.

Below is my code

Sub Initialize

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument

Dim ReminderDate As NotesDateTime
Dim CurrDate As NotesDateTime
Dim TempDoc As NotesDocument
Dim Email_Doc As NotesDocument
Dim nam As NotesName
Dim rtitem As NotesRichTextItem

Set db = session.Currentdatabase
Set view = db.Getview("Reminderemail")

Set doc = view.Getfirstdocument()

While Not doc Is Nothing
Set nam = session.CreateName(doc.Requestor(0)) 'Name of Requestor
Set TempDoc = view.Getnextdocument(doc)
Set ReminderDate = New NotesDateTime(doc.CreationDate(0))
Call ReminderDate.Adjustmonth(6)
Set CurrDate = New NotesDateTime(Today)

If Cdat(ReminderDate.Dateonly)=Cdat(CurrDate.Dateonly) Then
Set Email_Doc=db.CreateDocument
Email_Doc.Form = "Mail"
Email_Doc.Subject = "Reminder email"
Email_Doc.MailSent = "1"
Email_Doc.To = ""

ForAll obj In
Email_Doc.To_Comp=Email_Doc.To ''there is one field on form need to set
End ForAll

doc.ReminderFlag = "1" ''set reminder flag
doc.CreationDate=Cdat(Currdate.Dateonly) '' set creation date field again
Email_Doc.Saveoptions="1" ''need to set saveoptions field also
Call doc.Save(True,True)
Call Email_Doc.Send(True,"")

End If

Set doc = TempDoc


End Sub

Please suggest what can be the reason.

Thanks in advance

Go back