Email & Notifications
Send transactional emails from OQL. For web push notifications and webhooks see Push & Webhooks.
| Verb | Description |
|---|---|
EMAIL "body" TO "address" WITH "subject" | Send email. Body is the first operand — if it starts with < it is sent as HTML, otherwise plain text. |
EMAIL — plain text
EMAIL "Hello from OQL" TO "user@example.com" WITH "Test Email"
AFTER EMIT "Sent"
EMAIL — HTML body
EMAIL `<h1>Welcome to OQL</h1><p>Your account is ready.</p>`
TO "user@example.com"
WITH "Welcome!"
AFTER EMIT "Sent"
EMAIL — multi-line body with OPEN NEST
QUERY "orders" FROM "shop" WHERE status IS EQUAL TO "new" SET ?orders
AFTER LENGTH ?orders SET ?count
AFTER EMAIL
OPEN NEST
EMIT "You have " & ?count & " new orders."
CLOSE NEST
TO "admin@myshop.com"
WITH "New Orders Alert"
AFTER EMIT "Notified"
For push notifications and webhooks see Push & Webhooks.