Enabling scheduled messages programatically
Use the Summary DateTime item $SendAt
to enable scheduled
messaging.
About this task
- Example: Scheduling button formula
-
_def := @If(@IsAvailable($SendAt); $SendAt; @Now); _newValue := @Prompt([OkCancelEdit]; "Schedule delivery"; "Enter date and time this message should be sent"; @Text(_def)); REM {If user cancels, execution stops.}; _newValue := @TextToTime(_newValue); _valid := @If(!@IsTime(_newValue); @False; @Text(@Time(_newValue)) != "" & @Text(@Date(_newValue)) != ""); @If(!_valid; @Prompt([Ok]; "Schedule delivery"; "Please supply a date and time."); _newValue > @Now; FIELD $SendAt := _newValue; FIELD $SendAt := @DeleteField);
- Example: API
-
The item name is available as a #define in the SDK in
stdnames.h
#define MAIL_SENDAFTER_ITEM "$SendAt" /* Scheduled mail date and time specified */
- Example: LotusScript®
-
%REM Sub SendDelayedNotice Description: Send a specified user an email scheduled for delivery at 8AM tomorrow morning, with a reminder to review a specified document at that time. Arguments: recipient: email address of recipient. linkDoc: the document they are to review. %END REM Sub SendDelayedNotice(ByVal recipient As String, linkDoc As NotesDocument) Dim ses As New NotesSession, db As NotesDatabase, memo As NotesDocument, body As NotesRichTextItem Dim sendTime As Variant Set db = ses.CurrentDatabase Set memo = db.CreateDocument Call memo.ReplaceItemValue("Form", "Memo") Call memo.ReplaceItemValue("Subject", "Document review reminder") sendTime = Today + (4./3.) ' 8am tomorrow morning (in the current TZ) Call memo.ReplaceItemValue("$SendAt", sendTime) Set body = memo.CreateRichTextItem("Body") Call body.Appendtext("Good morning! It's time to review this document: ") Call body.Appenddoclink(linkDoc, "", "") body.Update Call memo.Send(False, recipient) End Sub