# 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.

Endpoint: GET /Email/change_mx
Version: 11.136.0.4
Security: BasicAuth

## Query parameters:

  - `domain` (string, required)
    The mail exchanger's domain.
    Example: "example.com"

  - `exchanger` (string, required)
    The mail exchanger's name.
    Example: "mail.example.com"

  - `oldexchanger` (string, required)
    The mail exchanger's current name.
    Example: "mail.example.com"

  - `priority` (integer, required)
    The mail exchanger's new priority value.

Note:

  Common practice sets a priority value divisible by five.
    Example: 15

  - `alwaysaccept` (integer)
    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

  - `oldpriority` (integer)
    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: 5

## Response 200 fields (application/json):

  - `apiversion` (integer)
    The version of the API.
    Example: 3

  - `func` (string)
    The name of the method called.
    Example: "change_mx"

  - `module` (string)
    The name of the module called.
    Example: "Email"

  - `result` (object)

  - `result.data` (object)

  - `result.data.checkmx` (object)
    An object of the mail exchanger's data.

  - `result.data.checkmx.changed` (integer)
    Whether a change occurred during the function.
* 1 - Change occurred.
* 0 - No change.
    Enum: 0, 1

  - `result.data.checkmx.detected` (string)
    The mail exchanger type.
* auto
* local
* secondary
* remote
    Enum: "auto", "local", "secondary", "remote"

  - `result.data.checkmx.isprimary` (integer)
    Whether the mail exchanger is the primary mail exchanger.
* 1 - Primary.
* 0 - Not primary.
    Enum: 0, 1

  - `result.data.checkmx.issecondary` (integer)
    Whether the mail exchanger is a secondary exchanger.
* 1 - Secondary.
* 0 - Not secondary.
    Enum: 0, 1

  - `result.data.checkmx.local` (integer)
    Whether the mail exchanger is a local exchanger.
* 1 - Local.
* 0 - Not local.
    Enum: 0, 1

  - `result.data.checkmx.mxcheck` (string)
    The mail exchanger type.
* auto
* local
* secondary
* remote
    Enum: "auto", "local", "secondary", "remote"

  - `result.data.checkmx.remote` (integer)
    Whether the mail exchanger is a remote exchanger.
* 1 - Remote.
* 0 - Not remote.
    Enum: 0, 1

  - `result.data.checkmx.secondary` (integer)
    Whether the mail exchanger is a secondary exchanger.
* 1 - Secondary.
* 0 - Not secondary.
    Enum: 0, 1

  - `result.data.checkmx.warnings` (array)
    Warning messages, if any exist.
    Example: ["Auto Detect of MX configuration not possible due to non-resolving MX entries. Defaulting to last known setting: local."]

  - `result.data.results` (string)
    A message of success, or an error message.
* A message of success that begins with Added entry:.
* An error message.
    Example: "Replacing existing entry on line matched old entry and old priority: 51:\\nBind reloading on example using rndc zone: [example.com]"

  - `result.data.status` (integer)
    Whether the function succeeded.
* 1 - Success.
* 0 - Failure.
    Enum: 0, 1

  - `result.data.statusmsg` (string)
    A message of success, or an error message.
* A message of success that begins with Added entry:.
* An error message.
    Example: "Replacing existing entry on line matched old entry and old priority: 51:\\nBind reloading on example using rndc zone: [example.com]"

  - `result.errors` (array,null)
    List of errors if the API failed.

  - `result.messages` (array,null)
    List of messages generated by the API.

  - `result.metadata` (object)

  - `result.status` (integer)
    * 1 - Success.
* 0 - Failed. Check the errors field for more details.
    Enum: 0, 1

  - `result.warnings` (array,null)
    List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.


