Batch Sending
Send up to 1,000 emails in a single API call.
The batch send endpoint (POST /api/v1/emails/batch) lets you send up to 1,000 emails in a single API call. Each email in the batch is processed independently — a failure for one recipient does not abort the rest.
When to use batch sending
- Sending a newsletter or announcement to many recipients
- Dispatching order confirmations after a bulk import
- Any use case where you need to send many distinct emails at once
Code examples
import { SmailClient } from "@smail/smail-js";
const smail = new SmailClient({ apiKey: process.env.SMAIL_API_KEY! });
const result = await smail.emails.batch([
{
from: "newsletter@yourdomain.com",
to: ["alice@example.com"],
subject: "Our April newsletter",
html: "<p>Hello Alice, here is your newsletter.</p>",
type: "marketing",
},
{
from: "newsletter@yourdomain.com",
to: ["bob@example.com"],
subject: "Our April newsletter",
html: "<p>Hello Bob, here is your newsletter.</p>",
type: "marketing",
},
]);
console.log(`Sent ${result.count} emails`);result, err := client.Emails.Batch(ctx, []smail.SendEmailRequest{
{
From: "newsletter@yourdomain.com",
To: []string{"alice@example.com"},
Subject: "Our April newsletter",
HTML: "<p>Hello Alice, here is your newsletter.</p>",
Type: "marketing",
},
{
From: "newsletter@yourdomain.com",
To: []string{"bob@example.com"},
Subject: "Our April newsletter",
HTML: "<p>Hello Bob, here is your newsletter.</p>",
Type: "marketing",
},
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Sent %d emails\n", result.Count)Limits
- Maximum 1,000 emails per batch request
- Each email in the batch follows the same rules as a single send —
frommust be on a verified domain
Related
- Send Batch Emails reference — full endpoint documentation
- Sending overview — single email sending