Create mail exchanger record

This function creates a new MX record.

Important:

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

Authorizations:
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

Response Schema: application/json
object

Request samples

whmapi1 --output=jsonpretty \
  savemxs \
  domain='example.com' \
  name='mail.example.com' \
  exchange='mail.example.com' \
  preference='20'

Response samples

Content type
application/json
{
  • "metadata": {
    • "command": "savemxs",
    • "reason": "Bind reloading on server1 using rndc zone: [example.com]\n",
    • "result": 1,
    • "version": 1
    }
}