-
Notifications
You must be signed in to change notification settings - Fork 55
Managing Your Servers
Patrick Graham edited this page Dec 6, 2021
·
4 revisions
The Postmark API allows you to isolate the email you send into "Servers." You can think of these as "Virtual Mail Servers," all emails that you send or recieve using Postmark are associated with a single Server.
The Postmark API allows you to create, read, update, and delete Servers programatically.
$adminClient = new PostmarkAdminClient("<account token>");
$newServer = $adminClient->createServer("Test Server");
$adminClient = new PostmarkAdminClient("<account token>");
// You can 'page' and filter through your list of servers.
// In this case we skip 10 servers, and take 20 servers,
// with a names that contain 'test-'.
$servers = $adminClient->listServers(20, 10, 'test-');
foreach($servers->servers as $key=>$server){
echo $server->name;
}
$adminClient = new PostmarkAdminClient("<account token>");
$serverId = 42;
$server = $adminClient->getServer($serverId);
$adminClient = new PostmarkAdminClient("<account token>");
$updatedServer = $adminClient->editServer(42,"Update Test Server Name");
echo $updatedServer->name;
Since this is a destructive operation, you must request that this feature be enabled for your account from support: [support@postmarkapp.com](mailto:support@postmarkapp.com?subject=Please enable the DELETE Server API for my account.)
$adminClient = new PostmarkAdminClient("<account token>");
$serverId = 42;
$result = $adminClient->deleteServer($serverId);
The Postmark-PHP client can be installed from Packagist.
For additional information about the capabilities of the Postmark API, see Postmark Developers Documentation.