Skip to main content

Creating a client

paubox.New accepts optional functional options:

Retry configuration

By default the client makes up to 3 attempts (the first request plus 2 retries) for GET and DELETE requests that fail with 429, a 5xx response, or a network error, with exponential backoff between 100 ms and 2 s. MaxAttempts counts the first request.

Send a message

Message fields

The paubox.Ptr[T] helper creates a pointer to any value, which is required for optional fields typed as *T:

Response

Send a batch

Send up to 50 messages in a single API call. Each message gets its own tracking ID.

Check delivery status

disp.Data.Message.MessageDeliveries is a slice of per-recipient records:
DeliveryStatus values are exported as constants such as paubox.DeliveryStatusDelivered, paubox.DeliveryStatusProcessing, and paubox.DeliveryStatusHardBounced. Message-level open and click counts are on disp.Data.Message (TotalOpens, DistinctOpens, TotalClickCount, ClicksPerLink). Per-recipient open state is d.Status.OpenedStatus.

Dynamic templates

Templates use Handlebars syntax ({{variable_name}}).

Create a template

List templates

Get a template

Update a template

Delete a template

Send a templated message

Scheduled send

Schedule a message for future delivery, check its status, reschedule, or cancel it.

Schedule a message

ScheduledAt must be in the future and within 30 days.

Get scheduled message status

ScheduledMessageStatus fields:

Reschedule a message

Cancel a scheduled message

Error handling

All methods return a typed error. Use errors.As to inspect details and errors.Is to match sentinels:

Sentinel errors

ErrServerError matches only status 500. To detect any 5xx, use errors.As and check apiErr.StatusCode >= 500.