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.

Error handling

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