---
title: "Send a test email"
url: https://docs.corefinity.com/api/reference/site-settings/send-site-email-test
type: endpoint
last_updated: 2026-11-13
feature: email
related:
  - https://docs.corefinity.com/guides/sites/site-settings/outbound-email.md
  - https://docs.corefinity.com/mcp/tools/corestack_email_send_test.md
---
# Send a test email

Sends one test email from the site through a verified sending domain, the default unless `domain` names
another. The answer is a command: when its `status` is `queued` or `running`, follow it with the command
endpoint. Beside the limit on changes, a site may send 20 test emails a day (the day in UTC), counted with
the tests sent from the Control Panel and by AI assistants: `test.remaining_today` of the email settings says
how many are left, and a test past the last answers 429 `limit`, which no wait within the day lifts. One test
is sent at a time on a site.

```http
POST /api/corestack/sites/{site}/email/test
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 12 a minute; 20 a day for each environment
- Try it in the console: off. It sends email to real people. Copy the request and run it yourself when you are sure.

## Path parameters

- `site` (integer, required): The id of a site row. A website's production site and each of its environments has its own id. Digits only.

## Body

- `domain` (string): The sending domain to send through, by its name or its `id`. Left out, the default.
- `to` (string, required): The address to send the test to. At most 254 characters, without quotes or angle brackets.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/email/test \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "tom.harbour@harbourandfinch.example.com"
  }'
```

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/corestack/sites/1042/email/test', [
        'to' => 'tom.harbour@harbourandfinch.example.com',
    ]);

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/email/test', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    to: 'tom.harbour@harbourandfinch.example.com',
  }),
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.post(
    "https://manage.corefinity.com/api/corestack/sites/1042/email/test",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "to": "tom.harbour@harbourandfinch.example.com",
    },
)

data = res.json() if res.content else None
```

## Responses

### 202 The test was started. `command.result` holds its outcome once it has finished.

```json
{
  "command": {
    "blocked_until_verified": false,
    "duration_ms": 0,
    "error": null,
    "exit_code": 0,
    "finished_at": "2026-11-03T09:16:40Z",
    "id": 6187,
    "input": {
      "domain": "mg.harbourandfinch.example.com",
      "to": "tom.harbour@harbourandfinch.example.com"
    },
    "kind": "email_test",
    "label": "Send a test email",
    "operation_id": null,
    "output_excerpt": "sent\n",
    "queued_at": "2026-11-03T09:16:40Z",
    "requested_by": {
      "id": 2012,
      "name": "Daniel Reyes"
    },
    "result": {
      "message": "Sent. Check the inbox (and spam) of tom.harbour@harbourandfinch.example.com.",
      "sent": true
    },
    "site": {
      "domain": "harbourandfinch.example.com",
      "id": 1042
    },
    "started_at": "2026-11-03T09:16:40Z",
    "status": "succeeded",
    "status_label": "Done"
  }
}
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the scope (`scope_required`, with the `scope` to use), your company requires two-factor authentication and you have not set it up, or your account has no company that can use Managed Clusters, for example because the company was closed (`company_unavailable` or `company_not_enabled`, whichever the route checks first). For Managed Clusters routes; any other route uses `ForbiddenScopeOrTwoFactor`.

```json
{
  "code": "company_unavailable",
  "message": "Your company is unavailable.",
  "reason": "company_unavailable"
}
```

### 404 The site id does not exist or is a site you cannot change, the feature is not on for your company (`feature_off`), or the site has no sending domain by that name or id (`tenant_mismatch`).

```json
{
  "code": "feature_off",
  "message": "Not found.",
  "reason": "feature_off"
}
```

### 409 The test cannot be sent now. `reason` says why: `state` (the sending domain is not verified, or the site does not send through it yet), `command_running` (another test, or another action, is still running on the site), `busy` (a change is running), `restore_running`, `deployment_running`, `not_running` (the site is not running), `exec_unresolved` (an earlier command has not been confirmed stopped: contact support), `removed`, `deleted`, `provisioning` or `managed_elsewhere`.

```json
{
  "code": "busy",
  "message": "Another change to this site is in progress. Wait for it to finish.",
  "reason": "busy"
}
```

### 422 `to` is missing or not an email address (`invalid`, with `field` and `errors`).

```json
{
  "code": "invalid",
  "errors": {
    "to": [
      "Enter the address to send the test email to"
    ]
  },
  "field": "to",
  "message": "Enter the address to send the test email to",
  "reason": "invalid"
}
```

### 429 Too many requests. `rate_limited`: the limit on changes is spent; wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats. `limit`: the site has sent its 20 test emails for today; this answer carries no `Retry-After`, no `X-RateLimit-Reset` and no `retry_after_seconds`, and the count starts again at midnight UTC.

```json
{
  "code": "limit",
  "message": "Twenty test emails a day per site. Try again tomorrow.",
  "reason": "limit"
}
```

### 503 Corefinity has switched commands on sites off for the moment (`switched_off`), or the site's cluster could not be reached, which is answered with a message only. Try again later.

```json
{
  "message": "The cluster could not be reached"
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | Send a valid token as `Authorization: Bearer <token>`. |
| 403 | `company_unavailable` | Your company is unavailable. |
| 403 | `scope_required` | Use a token with the scope named in `scope`. |
| 403 | `two_factor_required` | Turn on two-factor on your account, then send again. |
| 404 | `feature_off` | This feature is not on for your organisation yet. |
| 404 | `tenant_mismatch` | The object does not exist or the token may not see it. Check the id. |
| 409 | `busy` | Another operation is running on the site. Wait for it to finish. |
| 409 | `command_running` | Another action or command is still running on the site. Wait for it to finish, then try again. |
| 409 | `state` | What the request acts on is not in a state that allows this. Read the message. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 429 | `limit` | A limit on how many of these there can be, or how often this can be done, has been reached. Read the message: remove or close one, or try again later. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |
| 503 |  | Try again shortly. |
| 503 | `switched_off` | Corefinity has switched this action off for the moment. Try again later. |

## The same task elsewhere

- Guide: [Outbound email](https://docs.corefinity.com/guides/sites/site-settings/outbound-email.md)
- MCP tool: [`corestack_email_send_test`](https://docs.corefinity.com/mcp/tools/corestack_email_send_test.md)
