Send e-mail

Sends a plaintext e-mail to the address specified in the Email property of a directory object. To be able to send e-mail via Adaxes, you need to configure mail settings.

POST ~/api/directoryObjects/sendMail

Adaxes will send the e-mail from the address specified in the Email property of the authenticated user. If their Email property is empty, Adaxes will use the From address, configured in the mail settings.

Request parameters

This request has no parameters.

Request headers

  • Name

  • Required

  • Description

  • Adm-Authorization

  • True

  • Specify the security token obtained during authentication.

  • Content-Type

  • True

  • Use application/json as the value of this header.

Request body

The request body is a JSON object with the following data structure:

  "directoryObject": "<objectId>",
  "subject": "<mailSubject>",
  "text": "<mailBody>"

directoryObject string

The identifier of the directory object to send e-mail to. A directory object can be identified by:

 Distinguished name (DN)
# Example
CN=John Smith,CN=Users,DC=example,DC=com
 Globally unique identifier (GUID)
# Example
 Security identifier (SID)
# Example

subject string

The subject of the e-mail.

text string

The body of the e-mail.


If successful, returns 200 OK status code and an operation result in the response body. Otherwise, returns one of the common HTTP error codes and an error description in the response body.


 Send an email to a user

The following code sample sends an email to the specified user.


$baseUrl = ""
$endpoint = "/api/directoryObjects/sendMail"

# Request parameters
$requestUrl = $baseUrl + $endpoint
$requestHeaders = @{"Adm-Authorization" = YOUR-SECURITY-TOKEN}
$requestBody = ConvertTo-Json @{
    "directoryObject" = "CN=John Smith,CN=Users,DC=example,DC=com";
    "subject" = "My email subject";
    "text" = "My email body"

# Make request
Invoke-RestMethod -Method POST -Headers $requestHeaders -Uri $requestUrl `
  -Body $requestBody -ContentType "application/json"
using System;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;

class Program
    static async Task Main()
        const string baseUrl = "";
        const string endpoint = "/api/directoryObjects/sendMail";
        // Create JSON request body
        string jsonRequest = @"
            'directoryObject': 'CN=John Smith,CN=Users,DC=example,DC=com',
            'subject': 'My email subject',
            'text': 'My email text'
        StringContent requestBody = new(jsonRequest, Encoding.UTF8, "application/json");

        // Initialize HTTP client
        using HttpClient client = new();
        client.DefaultRequestHeaders.Add("Adm-Authorization", YOUR-SECURITY-TOKEN);

        // Make request
        HttpResponseMessage response = await client.PostAsync(
            baseUrl + endpoint, requestBody);
        string responseBody = response.Content.ReadAsStringAsync().Result;
curl  --header 'Adm-Authorization: YOUR-SECURITY-TOKEN' \
--header 'Content-Type: application/json' \
--request POST '' \
--data-raw '{
    "directoryObject": "CN=John Smith,CN=Users,DC=example,DC=com",
    "subject": "My email subject",
    "text": "My email body"
var https = require('https');

// Request parameters
var options = {
    'method': 'POST',
    'hostname': '',
    'path': '/restApi/api/directoryObjects/sendMail',
    'headers': {
        'Adm-Authorization': 'YOUR-SECURITY-TOKEN',
        'Content-Type': 'application/json'

// Create JSON request body
var postData = `
    "directoryObject": "CN=John Smith,CN=Users,DC=example,DC=com",
    "subject": "My email subject",
    "text": "My email body"

// Make request
var req = https.request(options, res => {
    var data = [];

    res.on("data", chunk => {

    res.on("end", () => {
        var body = Buffer.concat(data);

    res.on("error", error => {

import requests
import json

baseUrl = ""
endpoint = "/api/directoryObjects/sendMail"

# Request parameters
requestUrl = baseUrl + endpoint
requestHeaders = {"Adm-Authorization": YOUR-SECURITY-TOKEN}
requestBody = {
    "directoryObject": "CN=John Smith,CN=Users,DC=example,DC=com",
    "subject": "My email subject",
    "text": "My email body"

# Make request
request =, headers=requestHeaders, json=requestBody)
response = json.loads(request.content)


HTTP Status code: 200 OK
Response body:

    "resultType": 0,
    "innerMessages": [],
    "exception": null,
    "actualObjectDN": null,
    "extraInfo": {}

See also