# Update Mail Exchanger type

This function sets the Mail Exchanger (MX) type.

Note:

  This function only affects the cPanel configuration. You must configure the mail exchanger's DNS entry separately.

Important:

When you disable the DNS role, the system disables this function.

Endpoint: GET /Email/set_always_accept
Version: 11.136.0.19
Security: BasicAuth

## Query parameters:

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

  - `alwaysaccept` (string)
    The mail exchanger type.
* auto — Allow cPanel to determine the appropriate role.
* local — Always accept the domain's mail.
* secondary — Accept mail until a higher priority mail server is available.
* remote — Do not accept mail.

Note:

This parameter is redundant with the mxcheck parameter. Do not enter the mxcheck and alwaysaccept
parameters at the same time. Undefined behavior may occur if this
happens.
    Enum: "auto", "local", "secondary", "remote"

  - `mxcheck` (string)
    The mail exchanger type.
* auto — Allow cPanel to determine the appropriate role.
* local — Always accept the domain's mail.
* secondary — Accept mail until a higher priority mail server is available.
* remote — Do not accept mail.

Note:

This parameter is redundant with the alwaysaccept parameter. Do not enter the mxcheck and alwaysaccept
parameters at the same time. Undefined behavior may occur if this
happens.
    Enum: "auto", "local", "secondary", "remote"

## Response 200 fields (application/json):

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

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

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

  - `result` (object)

  - `result.data` (object)

  - `result.data.checkmx` (object)
    An object containing 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 — Allow cPanel to determine the appropriate role.
* local — Always accept the domain's mail.
* secondary — Accept mail until a higher priority mail server is available.
* remote — Do not accept mail.
    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 — Allow cPanel to determine the appropriate role.
  * local — Always accept the domain's mail.
  * secondary — Accept mail until a higher priority mail server is available.
  * remote — Do not accept mail.
    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)
    An array of warning messages, if any exist. One or more warning messages.
    Example: ["Auto Detect of MX configuration not possible due to non-resolving MX entries. Defaulting to last known setting: local."]

  - `result.data.detected` (string)
    The mail exchanger type.
  * auto — Allow cPanel to determine the appropriate role.
  * local — Always accept the domain's mail.
  * secondary — Accept mail until a higher priority mail server is available.
  * remote — Do not accept mail.
    Example: "auto"

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

  - `result.data.mxcheck` (string)
    The mail exchanger type.
  * auto — Allow cPanel to determine the appropriate role.
  * local — Always accept the domain's mail.
  * secondary — Accept mail until a higher priority mail server is available.
  * remote — Do not accept mail.
    Example: "auto"

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

  - `result.data.results` (string)
    A message of success or a reason for failure.
* A message of success that includes the new type.
* A string that describes an error.
    Example: "Set Always Accept Status to: local"

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

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

  - `result.data.statusmsg` (string)
    A message of success or a reason for failure.
* A message of success that includes the new type.
* A string that describes an error.
    Example: "Set Always Accept Status to: local"

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


