Skip to main content
Private Preview - This feature is currently in private preview.
npm install @insforge/sdk@latest
import { createClient } from '@insforge/sdk';

const insforge = createClient({
  baseUrl: 'https://your-app.us-east.insforge.app',
  anonKey: 'your-anon-key'  // Optional: for public/unauthenticated requests
});

emails.send()

Send custom HTML emails to one or more recipients.

Parameters

  • to (string | string[], required) - Recipient email(s), max 50 recipients
  • subject (string, required) - Email subject line, max 500 characters
  • html (string, required) - HTML content of the email
  • cc (string | string[], optional) - CC recipient(s), max 50 recipients
  • bcc (string | string[], optional) - BCC recipient(s), max 50 recipients
  • from (string, optional) - Custom sender name, max 100 characters
  • replyTo (string, optional) - Reply-to email address, must be a valid email address

Returns

{
  data: {} | null,  // Empty object on success
  error: Error | null
}

Example

const { data, error } = await insforge.emails.send({
  to: ['[email protected]', '[email protected]'],
  cc: '[email protected]',
  from: 'Acme Support Team',
  subject: 'Team Update',
  html: '<h1>Weekly Update</h1><p>Here are this week\'s highlights...</p>',
  replyTo: '[email protected]'
});

if (error) {
  console.error('Failed to send email:', error.message);
  return;
}

console.log('Email sent successfully');