Mail & Redirection

OcaltQL sends email with the MAIL verb and performs HTTP redirects with REDIRECT. Both are fire-and-forget operations — they do not return a value and do not use SET. All modifiers are optional and can appear in any order.

MAIL

The MAIL verb sends an email. The body type — TEXT or HTML — is declared before BODY. All string delimiters are interchangeable. All modifiers can appear in any order.

Basic Email

Plain Text Email
MAIL TEXT BODY 'hello world' TO 'email@email.com' SUBJECT 'this is a subject'
HTML Email
MAIL HTML BODY '<h1>Hello</h1><p>World</p>' TO 'email@email.com' SUBJECT 'HTML message'

Recipients

Multiple recipients are comma-separated inside the TO value. CC and BCC follow the same pattern.

Multiple Recipients
MAIL TEXT BODY 'hello' TO 'email@email.com, email@email.co' SUBJECT 'multi recipient'
CC and BCC
MAIL TEXT BODY 'message' TO 'boss@site.com' CC 'team@site.com' SUBJECT 'report'
AFTER MAIL TEXT BODY 'message' TO 'boss@site.com' BCC 'secret@site.com' SUBJECT 'hidden copy'

Headers, Reply-To, and Attachments

Custom Header
MAIL TEXT BODY 'hello' HEADER 'From: blah@blah.com' TO 'email@email.com' SUBJECT 'with header'
Reply-To
MAIL TEXT BODY 'help needed' TO 'support@site.com' SUBJECT 'support' REPLY TO 'user@site.com'
Attachment
MAIL TEXT BODY 'see attached' TO 'client@site.com' SUBJECT 'invoice' ATTACH '/root/invoice.pdf'

String Delimiters and Modifier Order

Double quotes, single quotes, and backticks are fully interchangeable throughout MAIL. All modifiers can appear in any order after the verb.

Mixed Delimiters
MAIL HTML BODY "hello" HEADER 'From: sender@site.com' TO `email@email.com` SUBJECT "subject"
All Modifiers — Any Order
MAIL TO 'a@a.com, b@b.com' SUBJECT 'test' HEADER 'X-Custom: value' TEXT BODY 'hello' CC 'c@c.com' BCC 'd@d.com' REPLY TO 'e@e.com' ATTACH '/root/file.pdf'
MAIL is a side-effect verb. It does not return a value and does not accept SET.

REDIRECT

REDIRECT performs an HTTP redirect. It accepts a relative path or a full URL. The default status code is 302. Use AS to specify a different code. REDIRECT ends the script — nothing after it executes.

Basic Redirect
REDIRECT '/dashboard'
With Status Code
REDIRECT '/login' AS '302'
Conditional Redirect
IF ?user IS NULL
OPEN
  REDIRECT 'https://ql.ocalt.com/login' AS '302'
CLOSE
Redirect After Operation
RUN authenticate WITH ?token SET ?valid
AFTER IF ?valid IS EMPTY
OPEN
  REDIRECT 'https://ql.ocalt.com/error' AS '302'
CLOSE
OR
OPEN
  REDIRECT '/success' AS '302'
CLOSE
REDIRECT ends script execution immediately. Any statements after a REDIRECT are unreachable, including statements in the same chain.