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.
send(payload: SendMailPayload): Promise<SendMailResponse>
Parameters (SendMailPayload)
FieldTypeRequiredDescription
tostring | string[]YesRecipient email address(es).
subjectstringYesEmail subject line.
textstringNoPlain text body.
htmlstringNoHTML body.
Returns (SendMailResponse)
FieldTypeDescription
idstring | nullThe message ID from the provider (null if unavailable).
provider"byok" | "default"The provider used for sending.
monthlyUsagenumberTotal emails sent this month.
monthlyLimitnumberYour project’s monthly quota.
Example
const response = await client.mail.send({
  to: 'customer@example.com',
  subject: 'Welcome to urBackend',
  html: '<h1>Hi there!</h1><p>Thanks for joining.</p>'
});

console.log(response.id);