Overview

SendLayer allows you to send emails to multiple recipients in a single API call. This guide shows you how to send emails to multiple recipients using the SendLayer API, with examples for popular programming languages.

Prerequisites

Sending Emails to Multiple Recipients

You can send emails to multiple recipients by providing an array of email addresses in the to field. Each recipient will receive the same email content.
Rate Limit: When sending to multiple recipients, be aware of SendLayer’s rate limits. We recommend sending to no more than 100 recipients per request for optimal performance. For larger lists, consider using our bulk sending features or sending in batches.
import { SendLayer } from 'sendlayer';

const sendlayer = new SendLayer('your-api-key');

const params = {
  from: 'sender@example.com',
  to: ['recipient1@example.com', 'recipient2@example.com', 'recipient3@example.com'],
  subject: 'Newsletter Update',
  html: '<html><body><h1>Newsletter Update</h1><p>This is a newsletter sent to multiple recipients using SendLayer Node.js SDK</p></body></html>',
};

const response = await sendlayer.Emails.send(params);
Replace <apiKey> with your actual SendLayer API key in the request header.

Using CC and BCC

You can also use CC (Carbon Copy) and BCC (Blind Carbon Copy) to send emails to additional recipients. CC recipients will be visible to all recipients, while BCC recipients will be hidden from other recipients.
const params = {
  from: 'sender@example.com',
  to: ['recipient1@example.com', 'recipient2@example.com'],
  cc: ['cc1@example.com', 'cc2@example.com'],
  bcc: ['bcc1@example.com', 'bcc2@example.com'],
  subject: 'Meeting Invitation',
  html: '<html><body><h1>Meeting Invitation</h1><p>You are invited to our team meeting next week.</p></body></html>',
};

Including Names and Email Addresses

You can include both names and email addresses for senders and recipients to make your emails more professional and personal. This is especially useful for newsletters, announcements, or any communication where you want to display the sender’s name.
const params = {
  from: {
    name: 'John Smith',
    email: 'john@example.com'
  },
  to: [
    {
      name: 'Alice Johnson',
      email: 'alice@example.com'
    },
    {
      name: 'Bob Wilson',
      email: 'bob@example.com'
    },
    {
      name: 'Carol Davis',
      email: 'carol@example.com'
    }
  ],
  subject: 'Team Update',
  html: '<html><body><h1>Team Update</h1><p>Hello team, here is our weekly update.</p></body></html>',
};
See our Send Email guide for basic email sending instructions.

FAQ