# sendTestEmail mutation


`sendTestEmail` is a GraphQL mutation of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Sends a template as a test to 1 to 5 addresses. Call it to check how a template looks in a real
mailbox.

- Requires the `emailTemplate.manage` and `email.send` permissions.
- It works as [`sendEmail`](/chameleoon-max/mutation/send-email) with a template, sent only to the addresses you name. It
  drops `cc`, `bcc` and the template's default attachments.
- It prefixes the subject with `[TEST] ` and marks the message `isTest`.
- It links the message to nothing (not the resource, not an attachment's record), so the message
  never shows in a record's history. The API key that sent it, or an API key without a scope,
  reads it.
- Without a `resource`, a template written for a kind of record renders fixed, fictitious
  sample data.
- Its errors are those of [`sendEmail`](/chameleoon-max/mutation/send-email). It shares the `requestId`s of
  [`sendEmail`](/chameleoon-max/mutation/send-email), so a `requestId` used by one fails the other with `CONFLICT` and
  reason `REQUEST_ID_REUSED`.
- It returns as [`sendEmail`](/chameleoon-max/mutation/send-email) does. Read the message's status with
  [`emailMessage`](/chameleoon-max/query/email-message).

> An error whose path runs below this field does not mean the call failed: the message was
> queued, so do not retry. See [`Mutation`](/chameleoon-max/mutations).

It may render an invoice PDF.

Costs 11 points plus its selection.

## Arguments

- `input`: [`SendTestEmailInput!`](/chameleoon-max/type/send-test-email-input) · required

## Returns

[`SendEmailResult!`](/chameleoon-max/type/send-email-result)

## Example

**Mutation**

```graphql
mutation sendTestEmail($input: SendTestEmailInput!) {
  sendTestEmail(input: $input) {
    applied
    message {
      id
      status
      senderId
      fromAddress
      fromName
      replyTo
    }
  }
}
```

**Variables**

```json
{
  "input": {
    "template": "example",
    "to": [
      "example"
    ],
    "requestId": "example"
  }
}
```

**Response**

```json
{
  "data": {
    "sendTestEmail": {
      "applied": true,
      "message": {
        "id": "00000000-0000-4000-8000-000000000001",
        "status": "QUEUED",
        "senderId": "00000000-0000-4000-8000-000000000001",
        "fromAddress": "example",
        "fromName": "example",
        "replyTo": "example"
      }
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
