gizweb:outbox
An app's sent mail: each message is a record with its state, and each day counts its messages under the app's daily limit (counters.giz). Failed and bounced sends count too.
import * as Outbox from "gizweb:outbox";Types
Mail
type Mail = { @Key id: string; recipient: string; subject: string; body: string; day: i64; state: string; }One message of DAY (days since 1970): pending until the provider answers, then sent, queued or failed.
id:stringrecipient:stringsubject:stringbody:stringday:i64state:string
Functions
install
function install(d: Data.Db): bool throws Model.RejectionMakes the outbox tables when they are not there.
Effects: fail, read, write, console, io.
admit
function admit(d: Data.Db, mail: Mail, limit: i64): bool throws Model.RejectionRecords MAIL as pending when its day has sent fewer than LIMIT; a 429 otherwise.
Effects: fail, read, write, console, io.
settle
function settle(d: Data.Db, id: string, state: string): bool throws Model.RejectionSets the STATE of message ID.
Effects: fail, read, write, console, io.