Skip to main content

Instantiation

Credentials are read automatically from config.cfg (see Authentication). The constructor dies if API_KEY 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.

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 use TryCatch internally and die on API errors. Wrap calls in an eval block to catch failures: