You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • WHM API 1 Functions - set_manual_mx_redirects
Skip to end of metadata
Go to start of metadata

Description

This function lets you create a manual Exim mail exchanger (MX) redirect for a domain. An MX redirection lets you bypass the domain's MX lookup via the Domain Name System (DNS). This function adds the manual redirect entries to the /etc/manualmx file.

Note:

To remove a domain's manual MX redirection, use the WHM API 1 unset_manual_mx_redirect function.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/set_all_proxy_backends?api.version=1&domain=example.com&mx_host=mailhostexample.com&domain-1=example2.com&mx_host-1=192.0.2.0
 Command Line
whmapi1 set_all_proxy_backends domain=example.com mx_host=mailhostexample.com domain-1=anotherexample.com mx_host-1=192.0.2.0


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
	"metadata": {
		"result": 1,
		"version": 1,
		"reason": "OK",
		"command": "set_manual_mx_redirects"
	}
}


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain for which to add a manual MX redirect entry.

Note:

  • To add multiple domain entries, increment the parameter. For example, use the domaindomain-1, and domain-2 parameters.
  • For multiple domains, you must include its corresponding mx_host value.
A valid domain.example.com
mx_hoststring

Required

The domain or IP address (IPv4 or IPv6) to redirect the domain value's emails to.

Note:

  • To add multiple MX hosts, increment the parameter. For example, use the  mx_host mx_host-1, and  mx_host-2 parameters.
  • For multiple MX hosts, you must include its corresponding domain value.
A valid domain or IP address.mailhostexample.com

Returns

This function only returns metadata.