Skip to main content

Send

Send a batch of emails using the default context.

Parameters

[]*SendEmailRequest
required
Array of email requests to send in batch. Each request should follow the same structure as a single email send request.

Returns

Returns a *BatchEmailResponse containing the results of the batch send operation.

Example


SendWithContext

Send a batch of emails with a custom context.

Parameters

context.Context
required
Context for the request, useful for timeouts and cancellation.
[]*SendEmailRequest
required
Array of email requests to send in batch.

Returns

Returns a *BatchEmailResponse containing the results of the batch send operation.

Example


SendWithOptions

Send a batch of emails with custom context and options.

Parameters

context.Context
required
Context for the request, useful for timeouts and cancellation.
[]*SendEmailRequest
required
Array of email requests to send in batch.
*BatchSendEmailOptions
Additional options for the batch send operation.

Returns

Returns a *BatchEmailResponse containing the results of the batch send operation.

Example


Types

BatchSendEmailOptions

Additional options for batch email sending.
string
Unique key to ensure idempotent requests. Prevents duplicate sends if the same key is used.
BatchValidationMode
Controls the validation behavior for batch emails. Can be BatchValidationStrict (default) or BatchValidationPermissive.
  • BatchValidationStrict: Only sends the batch if all emails are valid
  • BatchValidationPermissive: Processes all emails, allowing partial success

BatchValidationMode

Validation mode constants for batch email sending.
BatchValidationMode
Only sends the batch if all emails are valid. This is the default mode.
BatchValidationMode
Processes all emails, allowing partial success. Failed emails will be listed in the Errors field of the response.

BatchEmailResponse

Response from a batch email send operation.
[]SendEmailResponse
Array of successful email send responses, each containing the email ID.
[]BatchError
Array of errors for specific emails in the batch when using permissive validation mode.

BatchError

Represents an error for a specific email in a batch request.
int
The index of the failed email in the original request array.
string
Error message describing why the email failed.