Create mail exchanger record

This function creates a Mail Exchanger (MX) record. For more information about MX record settings, read our Email Routing Configuration documentation.

Important:

When you disable the Receive Mail role, the system disables this function

Authorizations:
query Parameters
domain
required
string <domain>

The new mail exchanger's domain.

Example: domain=example.com
exchanger
required
string <domain>

The new mail exchanger's name.

Example: exchanger=mail.example.com
priority
required
integer >= 0

The new mail exchanger's priority value.

Note:

It is common practice to set a priority value that is divisible by five.

Example: priority=5
alwaysaccept
integer
Default: 0

Whether the mail exchanger accepts all mail for the domain.

  • 1 — The mail exchanger always accepts mail.
  • 0 — The mail exchanger does not always accept mail.
Enum: 0 1
Example: alwaysaccept=1

Responses

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object

Request samples

uapi --output=jsonpretty \
  --user=username \
  Email \
  add_mx \
  domain='example.com' \
  exchanger='mail.example.com' \
  priority='5'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "add_mx",
  • "module": "Email",
  • "result": {
    • "data": {
      • "checkmx": {
        • "changed": 1,
        • "detected": "auto",
        • "isprimary": 0,
        • "issecondary": 0,
        • "local": 0,
        • "mxcheck": "auto",
        • "remote": 0,
        • "secondary": 0,
        • "warnings": [
          • "Auto Detect of MX configuration not possible due to non-resolving MX entries. Defaulting to last known setting: local."
          ]
        },
      • "results": "Added entry:\\nBind reloading on example using rndc zone: [example.com]\\n",
      • "status": 1,
      • "statusmsg": "Added entry:\\nBind reloading on example using rndc zone: [example.com]\\n"
      },
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}