Description

This function installs a Sender Policy Framework (SPF) record for a domain on the DNS server.

Examples




https://hostname.example.com:2087/cpsess##########/json-api/install_spf_records?api.version=1&domain=example.com&domain=anotherexample.com&record="v%3dspf1%20ip4:10.0.0.1%20%2Ba%20%2Bmx%20%2Bip4:10.0.0.2%20%2Bip4:10.0.0.3%20-all"&record="v%3dspf1%20ip4:10.0.0.1%20%2Ba%20%2Bmx%20%2Bip4:10.0.0.2%20%2Bip4:10.0.0.3%20-all"




whmapi1 install_spf_records domain=example.com domain=anotherexample.com record="v=spf1 ip4:10.0.0.1 %2Ba %2Bmx %2Bip4:10.0.0.2 %2Bip4:10.0.0.3 -all" record="v=spf1 ip4:10.0.0.1 %2Ba %2Bmx %2Bip4:10.0.0.2 %2Bip4:10.0.0.3 -all"



{
   "data": {
      "payload": [
        {
            "domain": "example.com",
            "msg": "[ADD:TXT@example.com.:v=spf1 ip4:10.0.0.1 %2Ba %2Bmx %2Bip4:10.0.0.2 %2Bip4:10.0.0.3 -all]",
            "status": 1
        },
		{
			"domain": "anotherexample.com",
			"msg": "[no changes needed]",
			"status": "1"
		}
    ],
    "metadata": {
        "command": "install_spf_record",
	    "reason": "OK",
	    "status": 1,
		"version": 1
		}
	}
}



Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain for which to install an SPF record on the DNS server.

To install multiple SPF records, duplicate the parameter name. For example, use the domain=example.com, domain=example2.com, and domain=example3.com parameters.


A valid domain.example.com
recordstring

Required

An SPF record.

You must provide this parameter for every domain parameter.


A valid SPF record.


v=spf1 ip4:10.0.0.1 %2Ba %2Bmx %2Bip4:10.0.0.2 %2Bip4:10.0.0.3 -all

Returns

ReturnTypeDescriptionPossible valuesExample
payloadarray of hashes

An array that contains information about the domain's SPF record installation to the DNS server.

Each hash contains the domain, msg, and status returns.

                

domain

string

The SPF record's associated domain on the DNS server.

This function returns this value in the payload array.

A valid domain.

example.com

msg

string

The SPF record's installation status to the DNS server.

This function returns this value in the payload array.

A valid string.



[ADD:TXT@example.com.:v=spf1 ip4:10.0.0.1 %2Ba %2Bmx %2Bip4:10.0.0.2 %2Bip4:10.0.0.3 -all]


status

Boolean

Whether the system installed the SPF record to the DNS server.

This function returns this value in the payload array.

  • 1 — The system installed the SPF record on the DNS server.
  • 0 — The system cannot install the SPF record on the DNS server.
1