Skip to main content
Access mail methods via client.mail. This module allows you to send emails using your project’s configured mail provider (e.g. Resend).
Mail operations require a Secret Key (sk_live_...). This module should only be used in server-side environments (Node.js, Edge Functions, etc.). Never call these methods from a browser.

send

Send an email.
Parameters (SendMailPayload)

Payload modes

Use one of these modes:
  • Template mode: templateId or templateName (+ optional variables)
  • Direct mode: subject + at least one of text or html
Do not send both templateId and templateName in the same request.

Template resolution order

When you use templateName, urBackend resolves templates in this order:
  1. Project template (override)
  2. Global/system template
  3. Legacy embedded project template fallback (older projects only)

Placeholder syntax

  • Escaped placeholder: {{name}}
  • Raw placeholder: {{{htmlSnippet}}} (use carefully)
  • Nested variables: {{user.name}}
For URL fields, prefer escaped placeholders like {{appUrl}}. URL-like variables are sanitized to safe http/https URLs before rendering. Returns (SendMailResponse) Example