v1

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

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

get/Email/add_mx

Query parameters

domainstring domain required
Example:example.com

The new mail exchanger's domain.

exchangerstring domain required
Example:mail.example.com

The new mail exchanger's name.

priorityinteger required
Example:5

The new mail exchanger's priority value.

Note:

It is common practice to set a priority value that is 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.

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": "add_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": "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"
    },
    "status": 1
  }
}