Bulk email sending
Written by
Updated at July 8, 2026
Using the SendBulkEmail method, you can send multiple template emails in one request. Such a request contains a shared template and the emails to send. For each email, you can specify recipients, data to populate the template, headers, and tags.
Getting started
- Create a service account in the folder as the address. If you create the service account and address in different folders, you will get an error when attempting to send an email.
- Assign the
postbox.senderrole to the service account. - Create a static access key. Save the ID and secret key to a secure location. You will not be able to view the secret key properties again after you close the window.
- Configure the AWS CLI.
Sending emails
-
Prepare a
bulk-email.jsonfile:{ "FromEmailAddress": "Alice <alice@example.com>", "DefaultContent": { "Template": { "Headers": [ { "Name": "List-Unsubscribe", "Value": "<https://example.com/unsubscribe?user_id=sercet_hash>" } ], "TemplateContent": { "Subject": "Hello, {{name}}!", "Text": "Dear {{name}},\r\nYour order {{order_id}} is ready.", "Html": "<h1>Hello, {{name}}!</h1><p>Your order {{order_id}} is ready.</p>" }, "TemplateData": "{\"order_id\":\"0000\"}" } }, "BulkEmailEntries": [ { "Destination": { "ToAddresses": [ "bob@example.com" ] }, "ReplacementEmailContent": { "ReplacementTemplate": { "ReplacementTemplateData": "{\"name\":\"Bob\",\"order_id\":\"1234\"}" } }, "ReplacementHeaders": [ { "Name": "X-Customer-Segment", "Value": "new" } ], "ReplacementTags": [ { "Name": "customer", "Value": "bob" } ] }, { "Destination": { "ToAddresses": [ "charlie@example.com" ] }, "ReplacementEmailContent": { "ReplacementTemplate": { "ReplacementTemplateData": "{\"name\":\"Charlie\",\"order_id\":\"5678\"}" } } } ], "DefaultEmailTags": [ { "Name": "campaign", "Value": "orders" } ], "ConfigurationSetName": "ConfigSet" }Where:
FromEmailAddress: Sender's verified email address.DefaultContent.Template.TemplateContent: Shared template for the email subject and body.DefaultContent.Template.TemplateData: Default data to populate the template. The value must be a JSON object serialized to a string.BulkEmailEntries: List of emails to send. For each list item, you can specifyReplacementTemplateDatato override the template data for that specific email.DefaultEmailTagsandReplacementTags: Email tags. Tags fromReplacementTagscomplement or override those fromDefaultEmailTags.
Note
Template uses the Handlebars
syntax and supports simple substitutions. -
Send emails:
aws sesv2 send-bulk-email \ --cli-input-json file://bulk-email.json \ --endpoint-url https://postbox.cloud.yandex.netResult:
{ "BulkEmailEntryResults": [ { "Status": "SUCCESS", "MessageId": "<email_ID>" }, { "Status": "SUCCESS", "MessageId": "<email_ID>" } ] }The item order in
BulkEmailEntryResultsmatches that inBulkEmailEntries. Where an individual email is not delivered, the returned result contains the error status and description in theErrorfield of the corresponding item.