Description
This function modifies a Mail Exchanger (MX) record. For more information about MX record settings, read our Edit MX Entry documentation.
Examples
{
"messages":null,
"errors":null,
"status":1,
"metadata":{
},
"data":{
"statusmsg":"Replacing existing entry on line matched old entry and old priority: 51:\nBind reloading on example using rndc zone: [example.com]\n",
"checkmx":{
"warnings":[
],
"issecondary":0,
"local":1,
"remote":0,
"detected":"local",
"isprimary":1,
"changed":1,
"mxcheck":"local",
"secondary":0
},
"status":1,
"results":"Replacing existing entry on line matched old entry and old priority: 51:\nBind reloading on example using rndc zone: [example.com]\n"
}
}
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 account. |
example.com |
exchanger |
string |
Required The mail exchanger's name. |
A valid mail exchanger name. |
mail.example.com |
oldexchanger |
string |
The mail exchanger's current name. If you do not use this parameter, the function creates a new MX record. |
The name of an existing mail exchanger. |
mail.example.com |
preference |
integer |
Required The mail exchanger's new priority value. |
A positive integer. Note: Common practice sets a priority value divisible by five. |
15 |
oldpreference |
integer |
The mail exchanger's current priority value. If multiple MX entries match the oldexchangervalue, the system uses this parameter to find the correct entry. |
The existing mail exchanger's current priority value. |
5 |
alwaysaccept |
string |
Whether the mail exchanger accepts all mail for the domain. |
|
1 |
Returns
Return |
Type |
Description |
Possible values |
Example |
statusmsg |
string |
A message of success, or an error message. |
|
|
checkmx |
hash |
A hash of the mail exchanger's data. |
This hash includes the warnings, issecondary, local,detected, remote, isprimary, changed, secondary, andmxcheck returns. |
|
warnings |
array |
Warning messages, if any exist. The function returns this value in the checkmx hash. |
One or more warning messages. |
|
issecondary |
Boolean |
Whether the mail exchanger is a secondary exchanger. The function returns thisvalue in the checkmx hash. |
|
0 |
local |
Boolean |
Whether the mail exchanger is a local exchanger. The function returns thisvalue in the checkmx hash. |
|
0 |
detected |
string |
The mail exchanger type. The function returns thisvalue in the checkmx hash. |
|
auto |
remote |
Boolean |
Whether the mail exchanger is a remote exchanger. The function returns thisvalue in the checkmx hash. |
|
0 |
isprimary |
Boolean |
Whether the mail exchanger is the primary mail exchanger. The function returns thisvalue in the checkmx hash. |
|
0 |
changed |
Boolean |
Whether a change occurred during the function. The function returns thisvalue in the checkmx hash. |
|
1 |
secondary |
Boolean |
Whether the mail exchanger is a secondary exchanger. The function returns thisvalue in the checkmx hash. |
|
0 |
mxcheck |
string |
The mail exchanger type. The function returns thisvalue in the checkmx hash. |
|
auto |
status |
Boolean |
Whether the function succeeded. |
|
1 |
results |
string |
A message of success, or an error message. |
|
|