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 new mail exchanger's domain. Example: domain=example.com |
exchanger required | string <domain> The new mail exchanger's name. Example: exchanger=mail.example.com |
priority required | integer >= 0 The new mail exchanger's priority value. Note: It is common practice to set a priority value that is divisible by five. Example: priority=5 |
alwaysaccept | integer Default: 0 Whether the mail exchanger accepts all mail for the domain.
Example: alwaysaccept=1 |
uapi --output=jsonpretty \ --user=username \ Email \ add_mx \ domain='example.com' \ exchanger='mail.example.com' \ priority='5'
{- "apiversion": 3,
- "func": "add_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": "Added entry:\\nBind reloading on example using rndc zone: [example.com]\\n",
- "status": 1,
- "statusmsg": "Added entry:\\nBind reloading on example using rndc zone: [example.com]\\n"
}, - "errors": null,
- "messages": null,
- "metadata": { },
- "status": 1,
- "warnings": null
}
}