# Return mail exchanger records

This function lists Mail Exchanger (MX) records.

Important:

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

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

## Query parameters:

  - `domain` (string)
    The domain to query. If you do not use this parameter, the function returns MX records for all of the cPanel account's domains.
    Example: "example.com"

## Response 200 fields (application/json):

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

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

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

  - `result` (object)

  - `result.data` (array)

  - `result.data.alwaysaccept` (integer)
    Whether the domain's highest-priority mail exchanger accepts local mail.
* 1 - Accept local mail.
* 0 - Does not accept local mail.
    Enum: 0, 1

  - `result.data.detected` (string)
    The domain's highest-priority mail exchanger's type.
* auto
* local
* remote
* secondary
    Enum: "auto", "local", "remote", "secondary"

  - `result.data.domain` (string)
    The domain name.
    Example: "example.com"

  - `result.data.entries` (array)
    An array of objects that contains information about mail exchangers.

  - `result.data.entries.domain` (string)
    The mail exchanger's domain.
    Example: "example.com"

  - `result.data.entries.entrycount` (integer)
    The mail exchanger's order in the list of priorities. For example, the mail exchanger with the highest priority returns 1, and the next highest priority returns 2.
    Example: 1

  - `result.data.entries.mx` (string)
    The mail exchanger's name.
    Example: "mx.example.com"

  - `result.data.entries.priority` (integer)
    The mail exchanger's [priority value](https://go.cpanel.net/whmdocsEditMXEntry).
    Example: 5

  - `result.data.entries.row` (string)
    Whether the mail exchanger is an odd or an even entry.
* even
* odd
    Enum: "even", "odd"

  - `result.data.local` (integer)
    Whether the domain's highest priority mail exchanger is a local mail exchanger.
* 1 - Local.
* 0 - Not local.
    Enum: 0, 1

  - `result.data.mx` (string)
    The domain's highest-priority mail exchanger's name.
    Example: "mx.example.com"

  - `result.data.mxcheck` (string)
    The domain's highest-priority mail exchanger's type.
* auto
* local
* remote
* secondary
    Enum: "auto", "local", "remote", "secondary"

  - `result.data.remote` (integer)
    Whether the domain's highest-priority mail exchanger is remote.
* 1 - Remote.
* 0 - Not remote.
    Enum: 0, 1

  - `result.data.secondary` (integer)
    Whether the domain's highest-priority mail exchanger is secondary.
* 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 success or error message message.
* A success message.
* An error message.
    Example: "Fetched MX List"

  - `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.metadata.transformed` (integer)
    Post-processing may have transformed the data.
    Enum: 1

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


