Skip to main content

Instantiation

Credentials are read automatically from the .env file (see Authentication). No constructor arguments are needed.

Building a message

A message is assembled from three objects (Header, Content, and Message) plus optional Attachment objects.

Content

Message

Attachments

Send a message

The response is a stdClass object:

Check delivery status

$disposition->data->message->message_deliveries is an array of per-recipient objects:
Common deliveryStatus values: delivered, opened, failed, pending.

Error handling

Both sendMessage and getEmailDisposition throw \Exception on failure. Wrap calls in a try/catch block:
sendMessage throws if the Header or Content is null, or if the API response cannot be parsed. getEmailDisposition throws if the response cannot be parsed.