Skip to main content
npm install @insforge/sdk@latest
import { createClient } from '@insforge/sdk';

const insforge = createClient({
  baseUrl: 'https://your-app.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
When Custom SMTP is enabled for your project, the from field is ignored. The sender name and email are always taken from your SMTP configuration to prevent spoofing through your server.

Returns

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

Example

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

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

console.log('Email sent successfully');