Hoppa till innehållet

Get started

Test servers

A test server takes mail exactly as a live server does, and delivers none of it. Use one for your staging environment and your CI, and keep a live server for mail that must arrive.

A test server works from the moment your account exists, before Sendora approves it and before payment. A send to it is checked as a live send is: the key, the From domain and the suppression list. Its limits are the test servers’ own, and a paused or closed account’s test servers take nothing. The message is stored in the log, and your webhooks fire. It never reaches a mail server, so nothing reaches a recipient.

Create a test server

In the dashboard, tick Testserver when you create the server under Servers › New server. With the account key, set mode: "test":

POST /v1/servers
curl -X POST https://api.sendora.se/v1/servers \
  -H "Authorization: Bearer $SENDORA_ACCOUNT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "CI",
  "mode": "test"
}'
import { SendoraAccount } from '@sendora/sdk';

const account = new SendoraAccount({
  token: process.env.SENDORA_ACCOUNT_TOKEN,
});

const server = await account.servers.create({
  name: 'CI',
  mode: 'test',
});

console.log(server.token.token);
import os

from sendora import SendoraAccount

account = SendoraAccount(
    os.environ["SENDORA_ACCOUNT_TOKEN"]
)

server = account.servers.create(name="CI", mode="test")

print(server.token.token)
<?php

use Sendora\SendoraAccount;

// The key comes from SENDORA_ACCOUNT_TOKEN.
$account = new SendoraAccount();

$server = $account->servers->create(
    name: 'CI',
    mode: 'test',
);

echo $server->token->token, "\n";
import se.sendora.SendoraAccount;
import se.sendora.model.CreateServerRequest;
import se.sendora.model.CreatedServer;
import se.sendora.model.ServerMode;

class CreateTestServer {
  public static void main(String[] args) {
    CreateServerRequest request =
        CreateServerRequest.builder()
            .name("CI")
            .mode(ServerMode.TEST)
            .build();

    // The account key comes from SENDORA_ACCOUNT_TOKEN.
    try (var account = SendoraAccount.fromEnv()) {
      CreatedServer server =
          account.servers().create(request);
      System.out.println(server.token().token());
    }
  }
}

Response

{
  "serverId": "e4a7c2b9-3d1f-4b6e-9a8c-2f5d7b1e0c63",
  "name": "CI",
  "mode": "test",
  "createdAt": "2026-09-23T09:00:00.000Z",
  "token": {
    "tokenId": "c8e1f3a5-7b9d-4c2e-8f60-1a3b5c7d9e2f",
    "name": "default",
    "prefix": "sk_test_a1b2c3d4e5",
    "createdAt": "2026-09-23T09:00:00.000Z",
    "revokedAt": null,
    "token": "sk_test_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v"
  }
}

A test server’s keys start with sk_test_, so a key shows its kind wherever it is written down. The server has a Test label in the dashboard.

A server’s mode is fixed when you create it. An update that sets mode fails with 400 mode_immutable.

Send with it

Send as you would on a live server, with the test server’s key. The answer, the message in the log and every webhook have test: true:

POST /v1/email
curl -X POST https://api.sendora.se/v1/email \
  -H "Authorization: Bearer $SENDORA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "from": {
    "email": "no-reply@example.se",
    "name": "Example AB"
  },
  "to": [
    "hardbounce+signup-test@simulator.sendora.se"
  ],
  "subject": "Confirm your address",
  "text": "Confirm at https://example.se/confirm/abc123."
}'
import { Sendora } from '@sendora/sdk';

const sendora = new Sendora({
  token: process.env.SENDORA_API_TOKEN,
});

const { messageId, test } = await sendora.email.send({
  from: {
    email: 'no-reply@example.se',
    name: 'Example AB',
  },
  to: ['hardbounce+signup-test@simulator.sendora.se'],
  subject: 'Confirm your address',
  text: 'Confirm at https://example.se/confirm/abc123.',
});

console.log(messageId, test);
import os

from sendora import Sendora

sendora = Sendora(os.environ["SENDORA_API_TOKEN"])

accepted = sendora.email.send(
    from_={
        "email": "no-reply@example.se",
        "name": "Example AB",
    },
    to=["hardbounce+signup-test@simulator.sendora.se"],
    subject="Confirm your address",
    text="Confirm at https://example.se/confirm/abc123.",
)

print(accepted.message_id, accepted.test)
<?php

use Sendora\Sendora;

// The key comes from SENDORA_API_TOKEN.
$sendora = new Sendora();

$accepted = $sendora->email->send(
    from: [
        'email' => 'no-reply@example.se',
        'name' => 'Example AB',
    ],
    to: ['hardbounce+signup-test@simulator.sendora.se'],
    subject: 'Confirm your address',
    text: 'Confirm at https://example.se/confirm/abc123.',
);

printf(
    "%s %s\n",
    $accepted->messageId,
    $accepted->test ? 'test' : 'live',
);
import se.sendora.Sendora;
import se.sendora.model.AcceptedEmail;
import se.sendora.model.Email;

class SendToSimulator {
  public static void main(String[] args) {
    String bounces =
        "hardbounce+signup-test@simulator.sendora.se";
    String text =
        "Confirm at https://example.se/confirm/abc123.";
    Email email =
        Email.builder()
            .from("no-reply@example.se", "Example AB")
            .to(bounces)
            .subject("Confirm your address")
            .text(text)
            .build();

    // The server key comes from SENDORA_API_TOKEN.
    try (var sendora = Sendora.fromEnv()) {
      AcceptedEmail accepted =
          sendora.email().send(email);
      System.out.printf(
          "%s %s%n",
          accepted.messageId(),
          accepted.test() ? "test" : "live");
    }
  }
}

Response

{
  "messageId": "0b6f2d8e-4a1c-4e7b-9d3f-5c8a2e6b1f40",
  "status": "accepted",
  "submittedAt": "2026-09-23T09:01:00.000Z",
  "test": true
}

SMTP submission works too, with the test server’s key as both user name and password. The SMTP reply to the message says that it is a test.

The simulator’s addresses

A test server reports every recipient as delivered, without sending anything, except at simulator.sendora.se. There, the part before the @ decides what happens:

AddressWhat happens
hardbounce@simulator.sendora.seA hard bounce: the bounced webhook with hard: true, and the address is suppressed on that stream
softbounce@simulator.sendora.seA soft bounce, a full mailbox: the bounced webhook with hard: false, and no suppression
deferred@simulator.sendora.seThe deferred webhook, then delivered a minute later
complaint@simulator.sendora.seDelivered, then a spam complaint: the spam_complaint webhook, and the address is suppressed
opened@simulator.sendora.seDelivered, then opened 5 seconds later: the opened webhook, if the message is tracked
clicked@simulator.sendora.seDelivered, opened 5 seconds later and clicked 5 seconds after that: the opened and clicked webhooks, if the message is tracked
any other addressDelivered

Case does not matter. A +label after the name is kept, so hardbounce+signup-test@simulator.sendora.se bounces like hardbounce@. A suppression covers the whole address, label included, as on a live server. Give each test run its own label, so that a bounce in one run never blocks the next.

A live server refuses these addresses before anything is stored. Sent with a live server’s key, the same request fails with test_address_on_live_server:

POST /v1/email
curl -X POST https://api.sendora.se/v1/email \
  -H "Authorization: Bearer $SENDORA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "from": {
    "email": "no-reply@example.se",
    "name": "Example AB"
  },
  "to": [
    "hardbounce+signup-test@simulator.sendora.se"
  ],
  "subject": "Confirm your address",
  "text": "Confirm at https://example.se/confirm/abc123."
}'
import { Sendora, SendoraError } from '@sendora/sdk';

const sendora = new Sendora({
  token: process.env.SENDORA_API_TOKEN,
});

try {
  await sendora.email.send({
    from: {
      email: 'no-reply@example.se',
      name: 'Example AB',
    },
    to: ['hardbounce+signup-test@simulator.sendora.se'],
    subject: 'Confirm your address',
    text: 'Confirm at https://example.se/confirm/abc123.',
  });
} catch (error) {
  if (
    error instanceof SendoraError &&
    error.code === 'test_address_on_live_server'
  ) {
    console.log(error.addresses);
  } else {
    throw error;
  }
}
import os

from sendora import Sendora, SendoraError

sendora = Sendora(os.environ["SENDORA_API_TOKEN"])

try:
    sendora.email.send(
        from_={
            "email": "no-reply@example.se",
            "name": "Example AB",
        },
        to=[
            "hardbounce+signup-test@simulator.sendora.se"
        ],
        subject="Confirm your address",
        text=(
            "Confirm at "
            "https://example.se/confirm/abc123."
        ),
    )
except SendoraError as error:
    if error.code == "test_address_on_live_server":
        print(error.addresses)
    else:
        raise
<?php

use Sendora\Exception\SendoraException;
use Sendora\Sendora;

// The key comes from SENDORA_API_TOKEN.
$sendora = new Sendora();

try {
    $sendora->email->send(
        from: [
            'email' => 'no-reply@example.se',
            'name' => 'Example AB',
        ],
        to: [
            'hardbounce+signup-test@simulator.sendora.se',
        ],
        subject: 'Confirm your address',
        text: 'Confirm at '
            . 'https://example.se/confirm/abc123.',
    );
} catch (SendoraException $error) {
    $code = 'test_address_on_live_server';
    if ($error->errorCode !== $code) {
        throw $error;
    }
    echo implode(', ', $error->addresses), "\n";
}
import se.sendora.Sendora;
import se.sendora.exception.SendoraException;
import se.sendora.model.Email;

class RefusedOnLive {
  public static void main(String[] args) {
    String bounces =
        "hardbounce+signup-test@simulator.sendora.se";
    String text =
        "Confirm at https://example.se/confirm/abc123.";
    Email email =
        Email.builder()
            .from("no-reply@example.se", "Example AB")
            .to(bounces)
            .subject("Confirm your address")
            .text(text)
            .build();

    // The server key comes from SENDORA_API_TOKEN.
    try (var sendora = Sendora.fromEnv()) {
      sendora.email().send(email);
    } catch (SendoraException error) {
      switch (error.code()) {
        case TEST_ADDRESS_ON_LIVE_SERVER ->
            System.out.println(
                String.join(", ", error.addresses()));
        default -> throw error;
      }
    }
  }
}

Response

{
  "error": "test_address_on_live_server",
  "message": "Addresses at simulator.sendora.se act out an outcome on a test server and are never sent to from a live one. Send them from a test server.",
  "addresses": [
    "hardbounce+signup-test@simulator.sendora.se"
  ]
}

Opens and clicks

opened@ and clicked@ act out what live mail records when it is tracked. Switch tracking on for the message’s stream before you send, or set trackOpens and trackLinks on the send. A test server needs no tracking domain.

Each address acts out only what live mail would record, and is otherwise only delivered:

  • An open needs the message’s opens tracked and an HTML part.
  • A click needs its links tracked and a link that tracking would rewrite. It takes the first one, so a link marked data-sendora-no-track and the unsubscribe link are passed over. Without such a link, nothing is clicked.
  • An address on the server’s not-tracked list is never opened or clicked.

Each open and click reads as a person’s: automated is unlikely, and agent, client and device are null. The log and the webhooks show them as they show a live message’s, with test: true. The opened and clicked webhooks reach only a webhook that names them in its events, as Webhooks says.

Limits and cost

Test mail is free, and it never counts toward your plan or the account’s monthly cap. All of the account’s test servers share limits of their own, on Limits. A refusal under them has the scope test. Write to support if your CI needs more.

A test server counts toward the number of servers the account may have. A test server has no inbound stream, so receive mail on a live server. Creating one fails with 422 stream_kind_not_allowed.

A test server keeps messages for less time than a live server, as Limits gives. The content of attachments is deleted as soon as the simulator has the message.

Going live

A test server never becomes live. Create a live server and its key, and move your production configuration to them. Then make your application refuse a test key where mail must arrive:

isTestKey tells the two kinds of key apart:

import { isTestKey, Sendora } from '@sendora/sdk';

const token = process.env.SENDORA_API_TOKEN ?? '';
if (process.env.NODE_ENV === 'production' && isTestKey(token)) {
  throw new Error('SENDORA_API_TOKEN is a test key; nothing would be delivered');
}
const sendora = new Sendora({ token });

is_test_key tells the two kinds of key apart:

import os

from sendora import Sendora, is_test_key

token = os.environ["SENDORA_API_TOKEN"]
production = os.environ.get("APP_ENV") == "production"
if production and is_test_key(token):
    message = (
        "SENDORA_API_TOKEN is a test key; "
        "nothing would be delivered"
    )
    raise RuntimeError(message)
sendora = Sendora(token)

Keys::isTestKey() tells the two kinds of key apart:

<?php

use Sendora\Keys;
use Sendora\Sendora;

$token = (string) getenv('SENDORA_API_TOKEN');
$production = getenv('APP_ENV') === 'production';
if ($production && Keys::isTestKey($token)) {
    throw new RuntimeException(
        'SENDORA_API_TOKEN is a test key; '
            . 'nothing would be delivered',
    );
}
$sendora = new Sendora($token);

Keys.isTestKey() tells the two kinds of key apart:

import se.sendora.Keys;
import se.sendora.Sendora;

class RefuseTestKey {
  public static void main(String[] args) {
    String token =
        System.getenv()
            .getOrDefault("SENDORA_API_TOKEN", "");
    boolean production =
        "production".equals(System.getenv("APP_ENV"));
    if (production && Keys.isTestKey(token)) {
      throw new IllegalStateException(
          "SENDORA_API_TOKEN is a test key;"
              + " nothing would be delivered");
    }
    try (Sendora sendora =
        Sendora.builder().token(token).build()) {
      // Sendora[baseUrl=https://api.sendora.se], and
      // never the key.
      System.out.println(sendora);
    }
  }
}

A test key starts with sk_test_, and a live server’s key with sk_ alone. Check for sk_test_ when your application starts.

To ask the API instead, read the key’s server. The answer gives the server’s mode and the sending domains a From address may use. It also lists each limit a send meets, with how much this minute and this month have used:

GET /v1/server
curl https://api.sendora.se/v1/server \
  -H "Authorization: Bearer $SENDORA_API_TOKEN"
import { Sendora } from '@sendora/sdk';

const sendora = new Sendora({
  token: process.env.SENDORA_API_TOKEN,
});

const { mode, limits } = await sendora.server.get();
if (
  process.env.NODE_ENV === 'production' &&
  mode === 'test'
) {
  throw new Error('This key belongs to a test server');
}

console.log(limits);
import os

from sendora import Sendora

sendora = Sendora(os.environ["SENDORA_API_TOKEN"])

server = sendora.server.get()
if (
    os.environ.get("APP_ENV") == "production"
    and server.mode == "test"
):
    message = "This key belongs to a test server"
    raise RuntimeError(message)

print(server.limits)
<?php

use Sendora\Sendora;

// The key comes from SENDORA_API_TOKEN.
$sendora = new Sendora();

$server = $sendora->server->get();
if (
    getenv('APP_ENV') === 'production'
    && $server->mode === 'test'
) {
    throw new RuntimeException(
        'This key belongs to a test server',
    );
}

foreach ($server->limits as $limit) {
    printf(
        "%s %s %d of %d\n",
        $limit->scope,
        $limit->period,
        $limit->used,
        $limit->limit,
    );
}
import se.sendora.Sendora;
import se.sendora.model.OwnServer;
import se.sendora.model.ServerMode;

class ReadServer {
  public static void main(String[] args) {
    // The server key comes from SENDORA_API_TOKEN.
    try (var sendora = Sendora.fromEnv()) {
      OwnServer server = sendora.server().get();
      boolean production =
          "production".equals(System.getenv("APP_ENV"));
      if (production
          && server.mode() == ServerMode.TEST) {
        throw new IllegalStateException(
            "This key belongs to a test server");
      }
      for (var limit : server.limits()) {
        System.out.printf(
            "%s %s %d of %d%n",
            limit.scopeAsString(),
            limit.periodAsString(),
            limit.used(),
            limit.limit());
      }
    }
  }
}
Response (29 lines)
{
  "serverId": "e4a7c2b9-3d1f-4b6e-9a8c-2f5d7b1e0c63",
  "name": "CI",
  "mode": "test",
  "createdAt": "2026-09-23T09:00:00.000Z",
  "limits": [
    {
      "scope": "test",
      "period": "minute",
      "limit": 300,
      "used": 1,
      "resetsAt": "2026-09-23T09:02:00.000Z"
    },
    {
      "scope": "test",
      "period": "month",
      "limit": 10000,
      "used": 1,
      "resetsAt": "2026-10-01T00:00:00.000Z"
    }
  ],
  "inboundCap": null,
  "sendingDomains": [
    {
      "domain": "example.se",
      "failingSince": null
    }
  ]
}