Skip to main content

Instantiation

Credentials are read automatically from config.cfg (see Authentication). The constructor dies if API_KEY or API_USERNAME is missing.

Building a message

Messages are created with a single constructor call using named parameters:

Attachments

Each attachment is a hashref with three keys. Use MIME::Base64 to encode the file content:
String::Util::trim removes the trailing newline that encode_base64 appends.

Send a message

The response is a raw JSON string. Decode it to access fields:

Check delivery status

Common deliveryStatus values: delivered, opened, failed, pending.

Error handling

Both sendMessage and getEmailDisposition use TryCatch internally and die on API errors. Wrap calls in an eval block to catch failures: