---
title: "Send a test email with the unsaved SMTP values. A failure is returned in the body, not as an error status"
method: POST
path: "/v2/agency-CK/{agencyId}/smtp-configuration/test-mail"
tags: ["Agency Customization Kit Api Service"]
---

# Send a test email with the unsaved SMTP values. A failure is returned in the body, not as an error status

`POST /v2/agency-CK/{agencyId}/smtp-configuration/test-mail`

## Request

- Base URL: `https://app.metricool.com/api`
- URL: `https://app.metricool.com/api/v2/agency-CK/{agencyId}/smtp-configuration/test-mail`
- Auth: none declared

## Path parameters

- `agencyId` integer, required

## Request body

- AgencySmtpTestRequestDto: Test email sent with the unsaved SMTP values
  - `to` string, required: Recipient of the test email
  - `settings` AgencySmtpSettingsDto, required: SMTP server values filled in the form. Authentication is always on; ports 465 and 2465 use implicit SSL and any other port mandatory STARTTLS
    - `host` string, required: Outgoing mail server, without protocol
    - `port` integer, required: Server port: 25, 465, 587, 2465, 2525 or 2587
    - `user` string, required: Authentication user
    - `password` string: Password or API key in clear text. Empty keeps the stored one
    - `from` string, required: Sender email
    - `fromLabel` string: Sender name. When empty, the agency name is used

## Response `200`

Ok, see 'sent' for the result

- JsonOkResponseAgencySmtpTestResultDto
  - `metadata` object
  - `page` JsonPaging
    - `next` string
  - `data` AgencySmtpTestResultDto: Result of the test email
    - `sent` boolean: Whether the SMTP server accepted the email
    - `errorType` 'HOST_NOT_FOUND' | 'CONNECTION' | 'ENCRYPTION' | 'AUTHENTICATION' | 'SENDER_REJECTED' | 'OTHER': Error type when the email was not sent
    - `detail` string: Technical message returned by the server when the email was not sent

## Other responses

- `400`: Invalid SMTP configuration
- `403`: The user cannot manage the agency configuration
- `429`: Too many test emails in progress

---

[API](https://skmtc.dev/metricool/apis/metricool-api.md) · [All operations](https://skmtc.dev/metricool/apis/metricool-api/llms.txt) · [OpenAPI document](https://skmtc.dev/metricool/apis/metricool-api/revisions/aea9d9a8415a?raw)
