Update 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 mail exchanger's domain.

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

The mail exchanger's name.

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

The mail exchanger's current name.

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

The mail exchanger's new priority value.

Note:

Common practice sets a priority value divisible by five.

Example: priority=15
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
oldpriority
integer >= 0

The mail exchanger's current priority value. If multiple MX entries match the oldexchanger value, the system uses this parameter to find the correct entry.

Example: oldpriority=5

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 \
  change_mx \
  domain='example.com' \
  exchanger='mail.example.com' \
  oldexchanger='mail.example.com' \
  priority='15'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "change_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": "Replacing existing entry on line matched old entry and old priority: 51:\\nBind reloading on example using rndc zone: [example.com]",
      • "status": 1,
      • "statusmsg": "Replacing existing entry on line matched old entry and old priority: 51:\\nBind reloading on example using rndc zone: [example.com]"
      },
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}