Skip to content

staff.mailServers ​

6 methods on staff.mailServers. Each returns the answer's data and throws NoviqaError on a failed answer.

list ​

GET/admin/v1/mail-servers

List mail servers

Every outgoing e-mail (SMTP) server, by name. Passwords are never returned: has_password says whether one is stored. stats is computed from the e-mail outbox: sent, errors (given up after every retry), queued (waiting or being sent now) and avg_send_seconds (0 with no sent e-mail yet); the enabled default server's stats also count e-mails queued for "the default server" without a server of their own.

More details

Rights: the staff member needs every one of: config.mail.

Returns
Promise<MailServer[]>
The answer's data.
Errors
401auth.session_expired: session expired, sign in again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailServers.list()
bash
curl -X GET "$NOVIQA_API_URL/admin/v1/mail-servers" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": [
    {
      "created_at": "2026-09-25T10:15:00Z",
      "enabled": true,
      "has_password": true,
      "id": 1,
      "is_default": true,
      "login": 1001,
      "name": "Ann Smith",
      "password": "string",
      "security": "string",
      "sender_email": "string",
      "sender_name": "string",
      "server": "string"
    }
  ],
  "request_id": "5b7f2c1e"
}
ts
staff.mailServers.list(options?: RequestOptions): Promise<models.MailServer[]>

create ​

POST/admin/v1/mail-servers

Add a mail server

Adds an outgoing e-mail server. Required: name (1-64 letters, digits, spaces or . _ & # -, unique), sender_email (one bare address), server (host:port, port 1-65535). security is none, starttls (default; the upgrade is required) or tls; enabled defaults to true. sender_name up to 128 characters without line breaks or quotes; login and password up to 255 each; the password is stored sealed and never returned. is_default true makes it the server platform e-mails go through and takes the mark from the previous default. id, version, has_password and the times are set by the server. Writes a journal line.

More details

Rights: the staff member needs every one of: config.mail.

Request body
created_atstring
UTC time, RFC 3339.
enabledboolean
has_passwordboolean
read-only
idinteger
is_defaultboolean
the server used when none is named
loginstring
namestring
passwordstring
write-only: never returned, stored sealed
securitystring
none, starttls (upgrade required) or tls (from the start)
sender_emailstring
sender_namestring
serverstring
host:port
statsany
read-only: computed from the e-mail outbox
updated_atstring
UTC time, RFC 3339.
versioninteger
Returns
Promise<MailServer>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
409conflict: already exists
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailServers.create({
  enabled: true,
  is_default: true,
  login: "noreply@broker.example",
  name: "Main SMTP",
  password: "app-password",
  security: "starttls",
  sender_email: "noreply@broker.example",
  sender_name: "Broker Support",
  server: "smtp.broker.example:587"
})
bash
curl -X POST "$NOVIQA_API_URL/admin/v1/mail-servers" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "enabled": true,
  "is_default": true,
  "login": "noreply@broker.example",
  "name": "Main SMTP",
  "password": "app-password",
  "security": "starttls",
  "sender_email": "noreply@broker.example",
  "sender_name": "Broker Support",
  "server": "smtp.broker.example:587"
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "created_at": "2026-09-25T10:15:00Z",
    "enabled": true,
    "has_password": true,
    "id": 1,
    "is_default": true,
    "login": 1001,
    "name": "Ann Smith",
    "password": "string",
    "security": "string",
    "sender_email": "string",
    "sender_name": "string",
    "server": "string"
  },
  "request_id": "5b7f2c1e"
}
ts
staff.mailServers.create(body: models.MailServer, options?: RequestOptions): Promise<models.MailServer>

retrieve ​

GET/admin/v1/mail-servers/{id}

Read a mail server

One mail server, without its password.

More details

Rights: the staff member needs every one of: config.mail.

Parameters
idinteger · pathrequired
Numeric id.
Returns
Promise<MailServer>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailServers.retrieve(1)
bash
curl -X GET "$NOVIQA_API_URL/admin/v1/mail-servers/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "created_at": "2026-09-25T10:15:00Z",
    "enabled": true,
    "has_password": true,
    "id": 1,
    "is_default": true,
    "login": 1001,
    "name": "Ann Smith",
    "password": "string",
    "security": "string",
    "sender_email": "string",
    "sender_name": "string",
    "server": "string"
  },
  "request_id": "5b7f2c1e"
}
ts
staff.mailServers.retrieve(id: number, options?: RequestOptions): Promise<models.MailServer>

update ​

PATCH/admin/v1/mail-servers/{id}

Change a mail server

Changes the fields sent; id, has_password, created_at and updated_at are refused. password "" removes the stored password, leaving it out keeps it. Same rules as creating. version is required and must be the one last read, else conflict; setting is_default true takes the mark from the previous default. A body that changes nothing answers the server unchanged. Writes a journal line with the changed fields.

More details

Rights: the staff member needs every one of: config.mail.

Parameters
idinteger · pathrequired
Numeric id.
Request body
created_atstring
UTC time, RFC 3339.
enabledboolean
has_passwordboolean
read-only
idinteger
is_defaultboolean
the server used when none is named
loginstring
namestring
passwordstring
write-only: never returned, stored sealed
securitystring
none, starttls (upgrade required) or tls (from the start)
sender_emailstring
sender_namestring
serverstring
host:port
statsany
read-only: computed from the e-mail outbox
updated_atstring
UTC time, RFC 3339.
versioninteger
Returns
Promise<MailServer>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
409conflict: already exists
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailServers.update(1, {
  security: "tls",
  server: "smtp.broker.example:465",
  version: 2
})
bash
curl -X PATCH "$NOVIQA_API_URL/admin/v1/mail-servers/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "security": "tls",
  "server": "smtp.broker.example:465",
  "version": 2
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": {
    "created_at": "2026-09-25T10:15:00Z",
    "enabled": true,
    "has_password": true,
    "id": 1,
    "is_default": true,
    "login": 1001,
    "name": "Ann Smith",
    "password": "string",
    "security": "string",
    "sender_email": "string",
    "sender_name": "string",
    "server": "string"
  },
  "request_id": "5b7f2c1e"
}
ts
staff.mailServers.update(id: number, body: models.MailServer, options?: RequestOptions): Promise<models.MailServer>

delete ​

DELETE/admin/v1/mail-servers/{id}

Delete a mail server

Removes a mail server. Writes a journal line.

More details

Rights: the staff member needs every one of: config.mail.

Parameters
idinteger · pathrequired
Numeric id.
Returns
Promise<null>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailServers.delete(1)
bash
curl -X DELETE "$NOVIQA_API_URL/admin/v1/mail-servers/1" \
  -H "Authorization: Bearer $NOVIQA_TOKEN"
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": null,
  "request_id": "5b7f2c1e"
}
ts
staff.mailServers.delete(id: number, options?: RequestOptions): Promise<null>

test ​

POST/admin/v1/mail-servers/{id}/test

Send a test e-mail

Sends one test e-mail to to (one bare address) through this server right now, even if it is disabled, and waits for the server's answer. A failure answers invalid_input whose message carries the server's first error line; a stored password that can no longer be opened must be entered again. Every attempt writes a journal line.

More details

Rights: the staff member needs every one of: config.mail.

Parameters
idinteger · pathrequired
Numeric id.
Request body
tostring
the one address the test e-mail goes to
Returns
Promise<null>
The answer's data.
Errors
400invalid_input: invalid input
401auth.session_expired: session expired, sign in again
403auth.csrf_invalid: request refused: reload the page and try again
403auth.invalid_terminal: this terminal cannot be used here
403auth.otp_enrol_required: your group requires one-time codes: set them up to continue
403auth.password_change_required: you must change your password first
403forbidden: you do not have access to this action
404not_found: not found
500internal: something went wrong
ts
import { staff } from "@/lib/noviqa"

const data = await staff.mailServers.test(1, {
  to: "ops@broker.example"
})
bash
curl -X POST "$NOVIQA_API_URL/admin/v1/mail-servers/1/test" \
  -H "Authorization: Bearer $NOVIQA_TOKEN" \
  -H "Content-Type: application/json" \
  --data-raw '{
  "to": "ops@broker.example"
}'
json
{
  "success": true,
  "code": "ok",
  "message": "done",
  "data": null,
  "request_id": "5b7f2c1e"
}
ts
staff.mailServers.test(id: number, body: http.docMailServerTest, options?: RequestOptions): Promise<null>