v1

latestOpenAPI 3.0.2cPanel License2026-08-06657427.1 MB
Email DNS Settings

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.

get/Email/change_mx

Query parameters

domainstring domain required
Example:example.com

The mail exchanger's domain.

exchangerstring domain required
Example:mail.example.com

The mail exchanger's name.

oldexchangerstring domain required
Example:mail.example.com

The mail exchanger's current name.

priorityinteger required
Example:15

The mail exchanger's new priority value.

Note:

Common practice sets a priority value divisible by five.

alwaysaccept0 | 1
Example:1

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.
oldpriorityinteger
Example:5

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.

Response

HTTP Request was successful.

apiversioninteger

The version of the API.

funcstring

The name of the method called.

modulestring

The name of the module called.

Example response

{
  "apiversion": 3,
  "func": "change_mx",
  "module": "Email",
  "result": {
    "data": {
      "checkmx": {
        "changed": 1,
        "detected": "auto",
        "mxcheck": "auto",
        "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]"
    },
    "status": 1
  }
}