Skip to main content

/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

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)API key for authentication.
auth_tokenStringNoAuth 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

FieldTypeDescription
resultStringOK 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 Failed when 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.
Implementation details

Configuration Impact

SettingDefaultAffectsUser-visible impact
config.mail.transportnodemailer-smtp-transport fallback behaviorProcessing flowMail transport selection controls whether test email can be sent.
config.mail.configServer configurationProcessing flowSMTP/sendmail connection settings determine success or failure of test delivery.
white-labeling.emailFrom / white-labeling.emailCompanyEmptyMessage metadataIf configured, affects sender identity used by outbound email module.

Database Collections

CollectionUsed forData touched by this endpoint
countly.membersGlobal-admin validation and recipient lookupReads authenticated user's account and email address.