Create mail exchanger record

This function creates a new MX record.

Important:

When you disable the DNS role, the system disables this function.

SecurityBasicAuth
Request
query Parameters
domain
required
string <domain>

The zone record's domain.

Example: domain=example.com
exchange
required
string <domain>

The domain's mail exchanger.

Example: exchange=mail.example.com
name
required
string

The record name.

Example: name=mail.example.com
preference
required
integer >= 1

The MX record's priority order.

Note:

Lower numbers indicate a higher priority order.

Example: preference=20
class
string
Default: "IN"

The record's class.

Example: class=IN
ttl
integer >= 1
Default: 14400

The record's Time To Live (TTL) in seconds.

Example: ttl=14400
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
get/savemxs
Request samples
whmapi1 --output=jsonpretty \
  savemxs \
  domain='example.com' \
  name='mail.example.com' \
  exchange='mail.example.com' \
  preference='20'
Response samples
application/json
{
  • "metadata": {
    • "command": "savemxs",
    • "reason": "Bind reloading on server1 using rndc zone: [example.com]\n",
    • "result": 1,
    • "version": 1
    }
}