$email
$email.send(message) writes the message as an
_Email row, then hands it to the deployment's mail relay. The row
is the record: it says sent, or
failed with the reason, so a failed delivery is never lost. Where
the mail goes is the deployment's choice, not the app's; under
cnc dev every message lands in the dev portal's local mailbox and
comes back sent.
Send one
This page sends only to an address made up for your visit, under
outbox.example, a domain that never receives mail.
async $send() {
await $email.send({
to: this.to,
subject: this.subject,
text: this.body, // text, html, or both
})
}
// A message with no recipient or no body is refused
// with the field named, and no row is written.
Your outbox
The rows are read back by the page's server code, the way an app says "we emailed you at
14:02". The outbox holds every message the app sent, so the page asks only for the ones
addressed to your visit; a browser cannot read _Email at all.
const answer = await $data({
_schema: '_Email',
_where: { to: this.to },
_select: ['subject', 'text', 'status', 'error'],
})
Nothing sent yet.