-
Notifications
You must be signed in to change notification settings - Fork 53
Sending Batches
Andrew Theken edited this page Jan 16, 2015
·
8 revisions
The Postmark batch API allows you to send up to 500 messages at a time. To do so, create messages that follow the same names as outlined in the Postmark developer documentation.
//Create messages that follow the JSON naming convention
//referenced above.
$message1 = ['To' => "[email protected]",
'Cc' => "[email protected]",
'Subject' => "Message 1",
'TextBody' =>"Some plain text",
'From' => "[email protected]"];
$message2 = ['To' => "[email protected]",
'Cc' => "[email protected]",
'Subject' => "Message 1",
'HtmlBody' =>"<b>HELLO!</b>",
'From' => "[email protected]"];
$newClient = new PostmarkClient("server_token");
//Pass the messages as an array to the `sendEmailBatch` function.
$responses = newClient->sendEmailBatch([$message1, $message2]);
The Postmark-PHP client can be installed from Packagist.
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.