Skip to main content

Instantiation

After loading credentials with ConfigurationManager.getProperties(...), create the service:

Building a message

Messages are built by setting properties on Message, Header, and Content objects, then wiring them together:

Attachments

Base64-encode the file content before setting it on the attachment:

Send a message

The SendMessageResponse fields:

Check delivery status

Common deliveryStatus values: delivered, delivered via secure portal, soft bounced, hard bounced, processing. Opens are reported separately. In SDK v1.3.1 through v2.0.0, getEmailDisposition replaces any openedStatus the API sends with "unopened", so getStatus().getOpenedStatus() returns "unopened" for an opened message and null for one that hasn’t been opened. To check for an open, test getStatus().getOpenedTime() != null.

Scheduled send

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

Schedule a message

scheduledAt must be an ISO 8601 UTC datetime string in the future and within 30 days. The scheduling response classes have no errors field, so if the API rejects the request, the returned object’s fields are null.

Get scheduled message status

Reschedule a message

Cancel a scheduled message

Error handling

All EmailService methods declare throws Exception, but an HTTP error response doesn’t throw. The SDK returns the API’s error body as the response object, so check getErrors() before you use the tracking ID. An exception is thrown only for network failures and for responses the SDK can’t read. Use the fully qualified com.paubox.data.Error, because Error alone is ambiguous with java.lang.Error: