I would create a flag field, SendFlag, and when a document is created that is to be sent at a scheduled time, set the field to "NeedToSend." Change your view selection criteria to only select documents where SendFlag = "NeedToSend." Sort the view by date and time so the earliest dates and times are first.
You could have an agent similar to the one below scheduled to run hourly.
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim docNext As NotesDocument
Dim dtNow As New NotesDateTime( "" )
Dim dtSend As New NotesDateTime( "" )
Dim item As NotesItem
Dim intProcess As Integer
Set db = s.CurrentDatabase
Set view = "scheduledmailview"
Call dtNow.SetNow
' depending on how often your agent will run
' add minutes to the current time so it will
' include documents scheduled to be sent within
' that time period.
Call dtNow.AdjustMinute( 35 )
Set doc = view.GetFirstDocument
intProcess = True
While (intProcess)
Set item = doc.GetFirstItem( "sendDateTime" )
Set dtSend = item.DateTimeValue
If (dtSend < dtNow) Then
Set item = doc.ReplaceItemValue ( "SendFlag", "Sent" )
Call doc.Send(False)
Call doc.Save(True, False)
Else
intProcess = False
EndIF
Set doc = dc.GetNextDocument(doc)
Wend
End Sub
This was first published in September 2003