Description
This function lists mail exchangers. For more information about MX record settings, read our Edit MX Entry documentation.
Warning:
We strongly recommend that you use the following UAPI function instead of this function:
-
Email::list_mxs
— This function lists Mail Exchanger (MX) records.
Note:
This function is identical to the cPanel API 2 Email::listmxs
function.
Examples
Note:
Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.
Parameters
Parameter |
Type |
Description |
Possible values |
Example |
user |
string |
Required The account's username. |
A valid username on the cPanel account. |
user |
domain |
string |
The domain to query. If you do not use this parameter, the function returns a list of all mail exchangers on the cPanel account. |
A valid domain on the cPanel account. |
example.com |
Returns
Return |
Type |
Description |
Possible values |
Example |
statusmsg |
string |
A message of success or a reason for failure. |
|
Fetched MX List |
status |
Boolean |
Whether the function succeeded. |
|
1 |
entries |
array of hashes |
An array of hashes of a domain's mail exchangers. |
Each hash contains the priority,mx, domain, entrycount, and rowreturns. |
|
priority |
integer |
The mail exchanger's priority value. The function returns this value in the entries hash. |
A positive integer. |
5 |
mx |
string |
The mail exchanger name. The function returns this value in the entries hash. |
A valid mail exchanger on the domain or cPanel account. |
mail.example.com |
domain |
string |
The mail exchanger's domain. The function returns this value in the entries hash. |
A valid domain on the cPanel account. |
example.com |
entrycount |
integer |
The mail exchanger's order in the list of priorities. The function returns this value in the entries hash. |
A positive integer. For example, the mail exchanger with the highest priority returns 1, and the next highest priority returns 2. |
1 |
row |
string |
Whether the mail exchanger is an odd or an even entry. The function returns this value in the entries hash. |
|
odd |
local |
Boolean |
Whether the domain's highest-priority mail exchanger is a local mail exchanger. |
|
1 |
remote |
Boolean |
Whether the domain's highest-priority mail exchanger is remote. |
|
0 |
detected |
string |
The domain's highest-priority mail exchanger'stype. |
|
auto |
mx |
string |
The domain's highest-priority mail exchanger's name. |
A valid mail exchanger on the domain or cPanel account. |
mail.example.com |
domain |
string |
The domain. |
A valid domain on the cPanel account. |
example.com |
mxcheck |
string |
The domain's highest-priority mail exchanger'stype. |
|
auto |
secondary |
Boolean |
Whether the domain's highest-priority mail exchanger is secondary. |
|
0 |
alwaysaccept |
Boolean |
Whether the domain's highest-priority mail exchanger accepts local mail. |
|
1 |
reason |
string |
A reason for failure. Note: This function onlyreturns a reasonvalue if it failed. |
A string that describes the error. |
This is an error message. |
result |
Boolean |
Whether the function succeeded. |
|
1 |