Instantiation
After loading credentials withConfigurationManager.getProperties(...), create the service:
Building a message
Messages are built by setting properties onMessage, Header, and Content objects, then wiring them together:
Attachments
Base64-encode the file content before setting it on the attachment:Send a message
SendMessageResponse fields:
Check delivery status
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
BothsendMessage and getEmailDisposition declare throws Exception. Wrap calls in a try/catch block: