I have sent emails via and agent many times but usually it is referencing a field on the form at the value to use to add or deduct from to know when to send it. I have a client that wants to send out emails corresponding to the 20th of each month.
1st email - on the 15th saying it’s coming due.
2nd email on the 20th saying its due today.
3rd email on the 22nd saying it’s past due.
I know this should be easy but having to specify everything around a specific day is throwing me off a bit. Any guideance is greatly appreciated.
thank you!
LS
Subject: Send email related to a specific day of the month…
Maybe something like…
Select Case Day(Today)
Case 15:
//Send first email
Case 20:
//send second emial
Case 22:
//send third email
Case Else
//do anything that you want if it is not one of those dates
End Select
Schedule it to run daily and that should do it.
Subject: A bit more help
thank you Pete but I am still having a little bit of a problem. I am posting some code that I used a while back to send emails and it works great. But with this, I am still scratching my head.
I understand what you are saying but unsure how to get the other piece. On the documents will be a field that has the month in it (apr, may, jun, jul, aug…etc)
As it loops through the docs it needs to checkthis field to see if it is the current month and if the day is 15 or 20 or 22 and then send the email.
Here is the old code for a different agent…thanks again for any assitance.
Sub Initialize
'This agent looks at only the PI documents that have not been submitted (submit field = yes if submitted) for the current month and
'if the day is the 15th, 20th or 22nd, it sends an email.
On Error Goto ErrorHandler
Set Session = New NotesSession
Set DB = Session.CurrentDataBase
Dim DT As New NotesDateTime("01/01/90")
Dim DT5 As New NotesDatetime(Today)
Call DT5.AdjustDay(-5)
NL = Chr$(10) & Chr$(13)
Set View = DB.GetView("(piemaillkup)")
Set Doc = View.GetFirstDocument
Do While Not(Doc Is Nothing)
'If the Month is this month and the day is the 15th, send reminder
If Cdat(doc.SR_NotifyCompleteDate2(0)) = "" Then
If Cdat(doc.SR_NotifyCompleteDate(0)) < Cdat(DT5.dateonly) Then
body = "This is a system generated message *** PLEASE DO NOT REPLY TO SENDER *****." & NL _
& "If you need technical help contact the help desk at x2411" & NL _
& NL & "Service Request #: " & Doc.SR_RequestNumber(0) & " has been in User Testing more than 5 days. " +_
"Please follow up with the Requestor to ensure prompt Customer Service for our NAITS affiliates. Thank you!"+_
NL & "Check here to view the Service Request --> "
Subject = "Service Request " & Doc.SR_RequestNumber(0) & ": needs your attention"
SendTo = doc.SR_PersonAssigned(0)
Set DocLink = Doc
Linkmsg = "Click here to open this document now."
Call PIReminder(Db, SendTo, Subject, Body, DocLink, Linkmsg)
End If
End If
GotoNext:
Set Doc = View.GetNextDocument(Doc)
Loop
Exit Sub
ErrorHandler:
Msgbox "***Email Notifications - Error on F/U Reminders Reminder Agent:" & " ("&Str(Erl)&") "& Str(Err) & ": " & Error$
Resume GotoNext
End Sub