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, opened, failed, pending.

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.

Get scheduled message status

Reschedule a message

Cancel a scheduled message

Error handling

Both sendMessage and getEmailDisposition declare throws Exception. Wrap calls in a try/catch block: