This function creates a Mail Exchanger (MX) record. For more information about MX record settings, read our Email Routing Configuration documentation.
Important:
When you disable the Receive Mail role, the system disables this function.
domain required | string <domain> The mail exchanger's domain. Example: domain=example.com |
exchanger required | string <domain> The mail exchanger's name. Example: exchanger=mail.example.com |
oldexchanger required | string <domain> The mail exchanger's current name. Example: oldexchanger=mail.example.com |
priority required | integer >= 0 The mail exchanger's new priority value. Note: Common practice sets a priority value divisible by five. Example: priority=15 |
alwaysaccept | integer Default: 0 Whether the mail exchanger accepts all mail for the domain.
Example: alwaysaccept=1 |
oldpriority | integer >= 0 The mail exchanger's current priority value. If multiple MX entries match the Example: oldpriority=5 |
uapi --output=jsonpretty \ --user=username \ Email \ change_mx \ domain='example.com' \ exchanger='mail.example.com' \ oldexchanger='mail.example.com' \ priority='15'
{- "apiversion": 3,
- "func": "change_mx",
- "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."
]
}, - "results": "Replacing existing entry on line matched old entry and old priority: 51:\\nBind reloading on example using rndc zone: [example.com]",
- "status": 1,
- "statusmsg": "Replacing existing entry on line matched old entry and old priority: 51:\\nBind reloading on example using rndc zone: [example.com]"
}, - "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
}
}