/o/email_test
Endpoint
/o/email_test
Overview
Sends a test email to the authenticated global admin user's email address to verify current mail delivery setup.
This endpoint is configuration-dependent: the Countly instance must have a working mail transport configured. On instances without SMTP/sendmail transport, the request can authenticate successfully but still return 503 Failed.
Authentication
Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.
Permissions
- Required permission: Global Admin.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | String | Yes (or use auth_token) | API key for authentication. |
auth_token | String | No | Auth token as query parameter or countly-token header. |
Examples
Send test email
/o/email_test?api_key=YOUR_API_KEY
Response
Success Response
{
"result": "OK"
}
Response Fields
| Field | Type | Description |
|---|---|---|
result | String | OK when send operation succeeds. |
Error Responses
503 Service Unavailable
{
"result": "Failed"
}
400 Bad Request
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
400 Bad Request
{
"result": "Token not valid"
}
401 Unauthorized
{
"result": "User does not exist"
}
401 Unauthorized
{
"result": "User does not have right"
}
401 Unauthorized
{
"result": "User is locked"
}
401 Unauthorized
{
"result": "Token is invalid"
}
Behavior
- Validates global-admin access.
- Uses authenticated member email as recipient.
- Builds subject/body from localization file when available for the member language.
- Sends mail through configured server mail transport.
- Returns
503 Failedwhen the mail module cannot deliver through the configured transport.
Limitations
- Recipient address is always the authenticated admin user's email.
- The endpoint validates send attempt, not mailbox delivery/open status.
- Requires an operational mail transport on the target Countly server.
Related Endpoints
Implementation details
Configuration Impact
| Setting | Default | Affects | User-visible impact |
|---|---|---|---|
config.mail.transport | nodemailer-smtp-transport fallback behavior | Processing flow | Mail transport selection controls whether test email can be sent. |
config.mail.config | Server configuration | Processing flow | SMTP/sendmail connection settings determine success or failure of test delivery. |
white-labeling.emailFrom / white-labeling.emailCompany | Empty | Message metadata | If configured, affects sender identity used by outbound email module. |
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly.members | Global-admin validation and recipient lookup | Reads authenticated user's account and email address. |