Skip to content

Managing Your Servers

Patrick Graham edited this page Dec 6, 2021 · 4 revisions

About Servers:

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.

Creating a New Server:

$adminClient = new PostmarkAdminClient("<account token>");
$newServer = $adminClient->createServer("Test Server");

Getting a List of Servers:

$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;
}

Getting a Single Server:

$adminClient = new PostmarkAdminClient("<account token>");

$serverId = 42;
$server = $adminClient->getServer($serverId);

Updating a Server:

$adminClient = new PostmarkAdminClient("<account token>");

$updatedServer = $adminClient->editServer(42,"Update Test Server Name");

echo $updatedServer->name;

Deleting a Server:

Since this is a destructive operation, you must request that this feature be enabled for your account from support: [[email protected]](mailto:[email protected]?subject=Please enable the DELETE Server API for my account.)

$adminClient = new PostmarkAdminClient("<account token>");

$serverId = 42;
$result = $adminClient->deleteServer($serverId);