Instantiation
.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.
Header
Content
Message
Attachments
Send a message
stdClass object:
| Property | Description |
|---|---|
sourceTrackingId | Tracking ID for checking delivery status |
data | Raw response data |
errors | Array of error strings, if any |
Check delivery status
$disposition->data->message->message_deliveries is an array of per-recipient objects:
deliveryStatus values: delivered, opened, failed, pending.
Error handling
BothsendMessage 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.