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.

Authorizations:
query Parameters
domain
required
string <domain>

The mail exchanger's domain.

Example: domain=example.com
alwaysaccept
string
Default: "auto"

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"
Example: alwaysaccept=auto
mxcheck
string
Default: "auto"

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"
Example: mxcheck=auto

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 \
  set_always_accept \
  domain='example.com'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "set_always_accept",
  • "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."
          ]
        },
      • "detected": "auto",
      • "local": 0,
      • "mxcheck": "auto",
      • "remote": 0,
      • "results": "Set Always Accept Status to: local",
      • "secondary": 0,
      • "status": 1,
      • "statusmsg": "Set Always Accept Status to: local"
      },
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}