Description
This function modifies a mail exchanger's type. For more information about MX record settings, read our Edit MX Entrydocumentation.
Notes:
- This function only affects the cPanel configuration. You must configure the mail exchanger's DNS entry separately.
- This function is similar to the
Email::setalwaysaccept
function, but hooks and custom event handlers parse them as unique calls.
Warning:
We strongly recommend that you use UAPI instead of cPanel API 2. However, no equivalent UAPI function exists.
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 |
domain |
string |
Required The mail exchanger's domain. |
A valid domain on the cPanel account. |
example.com |
mxcheck |
string |
Required The mail exchanger type.
|
|
auto |
Returns
Return |
Type |
Description |
Possible values |
Example |
statusmsg |
string |
A message of success or a reason for failure. |
|
Set Always Accept Status to: local |
status |
boolean |
Whether the function succeeded. |
|
1 |
checkmx |
hash |
A hash of the mail exchanger's data. |
This hash contains thewarnings, issecondary,local, detected,remote, isprimary,changed, secondary, andmxcheck parameters. |
|
warnings |
string |
Warning messages, if any exist. The function returns this parameter in thecheckmx hash. |
One or more warning messages. |
|
issecondary |
boolean |
Whether the mail exchanger is a secondary exchanger. The function returns this parameter in thecheckmx hash. |
|
0 |
local |
boolean |
Whether the mail exchanger is a local exchanger. The function returns this parameter in thecheckmx hash. |
|
0 |
detected |
string |
The mail exchanger type. The function returns this parameter in thecheckmx hash. |
|
auto |
remote |
boolean |
Whether the mail exchanger is a remote exchanger. The function returns this parameter in thecheckmx hash. |
|
0 |
isprimary |
boolean |
Whether the mail exchanger is the primary mail exchanger. The function returns this parameter in thecheckmx hash. |
|
0 |
changed |
boolean |
Whether a change occurred during the function. The function returns this parameter in thecheckmx hash. |
|
1 |
secondary |
boolean |
Whether the mail exchanger is a secondary exchanger. The function returns this parameter in thecheckmx hash. |
|
0 |
mxcheck |
string |
The mail exchanger type. The function returns this parameter in thecheckmx hash. |
|
auto |
local |
boolean |
Whether the mail exchanger is a local exchanger. |
|
0 |
remote |
boolean |
Whether the mail exchanger is a remote exchanger. |
|
0 |
detected |
string |
The mail exchanger type. |
|
auto |
mxcheck |
string |
The mail exchanger type. |
|
auto |
secondary |
boolean |
Whether the mail exchanger is a secondary exchanger. |
|
0 |
results |
string |
A message of success or a reason for failure. |
|
Set Always Accept Status to: local |
reason |
string |
A reason for failure. Note: This function only returns areasonvalue if it failed. |
A string that describes the error. |
This is an error message. |
result |
boolean |
Whether the function succeeded. |
|
1 |