Skip to main content

The client

Call Paubox.configure before creating a client, even when you pass api_key:; see Authentication. send_mail and deliver_mail are aliases. email_disposition and message_receipt are aliases.

Building a message

Attachments

Attach files by path using the helper method. It detects the MIME type with the system file command:
Or set the attachments attribute directly with an array of hashes, each with fileName, contentType, and content. The SDK base64-encodes content, so pass the raw file bytes:

Send a message

Check delivery status

EmailDisposition fields: Each MessageDelivery struct has recipient and status. For a message with one recipient, the status struct has delivery_status, delivery_time, opened_status ('unopened' if not opened), and opened_time. For a message with more than one recipient, it has only delivery_status and delivery_time. Check disposition.errors? to detect API-level errors. Common delivery_status values: delivered, delivered via secure portal, soft bounced, hard bounced, processing. Opens are reported separately in opened_status.

Scheduled send

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

Schedule a message

scheduled_at must be an ISO 8601 UTC datetime string in the future and within 30 days. schedule_mail accepts a Paubox::Message, a Mail::Message, or a plain hash. It does not send templated messages.

Get scheduled message status

Reschedule a message

Cancel a scheduled message

Dynamic templates

Templates use Handlebars syntax ({{variable_name}}). The Paubox::DynamicTemplates methods always use the API key from Paubox.configure.

Create a template

List templates

Get a template

Update a template

Always pass a name. If you leave it out, the SDK sends an empty name and the API rejects the update with name: can't be blank.

Delete a template

Send a templated message

Error handling

Paubox::Client and Paubox::DynamicTemplates methods raise RestClient::ExceptionWithResponse on HTTP errors. Rescue the exception to inspect the response: