Batch email sending

Send up to 50 emails in a single API request by sending an array of parameters accepted by send email method in a object.

This is a recommended way to efficiently send emails to a large list of recipients. For example, if you're sending email report every week to all your users, consider batching.

Limitations

  • The total size of the request must be less than 10 MB.

Example

const configureSidemail = require("sidemail");
const sidemail = configureSidemail({ apiKey: "replace-with-your-api-key" });
  
const response = await sidemail.sendEmail([
	{
		toAddress: "user-1@example.com",
		fromAddress: "you@example.com",
		fromName: "Your app",
		templateName: "Weekly report",
	},
	{
		toAddress: "user-2@example.com",
		fromAddress: "you@example.com",
		fromName: "Your app",
		templateName: "Weekly report",
	},
	{
		toAddress: "user-3@example.com",
		fromAddress: "you@example.com",
		fromName: "Your app",
		templateName: "Weekly report",
	}
]);

Returns

The response contains an array of objects with an email ID and a status of email on success.

[
    {
      "id": "5e858953daf20f3aac50a3da",
      "status": "queued"
    },
    {
      "id": "5e858953daf20f3aac50a4da",
      "status": "queued"
    },
    {
      "id": "5e858953daf20f3aac50a5da",
      "status": "queued"
    },
]