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:
| Method | Description |
|---|---|
getSourceTrackingId() | Use to check delivery status |
getData() | Raw response data |
getErrors() | List of Error objects if the request failed |
Check delivery status
deliveryStatus values: delivered, opened, failed, pending.
Error handling
BothsendMessage and getEmailDisposition declare throws Exception. Wrap calls in a try/catch block: