Child pages
  • WHM API 1 Functions - validate_current_spfs

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function installs a Sender Policy Framework (SPF) record for one or more domains.

Multiexcerpt include
SpaceWithExcerptcom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@12665
MultiExcerptNameAPIDisabledSendMailRoleNonVersion
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleJSON API


Code Block
languagexml
https://hostname.example.com:2087/cpsess##########/json-api/validate_current_spfs?api.version=1&domain=example.com



Expand
titleCommand Line


Code Block
whmapi1 validate_current_spfs domain=example.com

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
   "data":{
      "payload":[
         {
            "state":"VALID",
            "ip_address":"0:0:0:0:0:ffff:c0a8:101",
            "ip_version":6,
            "expected":"ip6:0:0:0:0:0:ffff:c0a8:101",
            "records":[
               {
                  "state":"PASS",
                  "current":"v=spf1 +a +mx ip6:0:0:0:0:0:ffff:c0a8:101 ~all"
               }
            ],
            "domain":"example.com"
         }
      ]
   },
   "metadata":{
      "version":1,
      "command":"validate_current_spfs",
      "reason":"OK",
      "result":1
   }
}


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain for which to check the SPF records.

Note
titleNote:

To query multiple domains, duplicate the parameter. For example, use the domain=example.com, domain=example2.com, and domain=example3.com parameters.


A valid domain.example.com

Returns

ReturnTypeDescriptionPossible valuesExample
payloadarray of hashes

An array that contains information about a domain's SPF records.

Each hash contains the domain, state, expected, and records returns.

                

domain

string

The queried domain.

This function returns this value in the payload array.

A valid domain.example.com

state

string

The SPF record's status.

This function returns this value in the payload array.

  • VALID — A single SPF TXT record exists in the domain's DNS with the correct ip_address value or redirect mechanism.
  • MISMATCHED — An SPF TXT record exists for the domain that does not match the ip_address value.
  • MULTIPLE — Multiple SPF TXT records exist in the domain's DNS.
  • MISSING — No SPF TXT record exists for the domain's DNS.
VALID

expected

string

The SPF record for the domain in the DNS.

This function returns this value in the payload array.

A valid string.
ip6:0:0:0:0:0:ffff:c0a8:101

ip_address

string

The domain's IP address.

This function returns this value in the payload array.

A valid string.0:0:0:0:0:ffff:c0a8:101

ip_version

integer

The IP address version.

This function returns this value in the payload array.

  • 4
  • 6
6

records

array of hashes

The SPF records of the domain's DNS.

This function returns this value in the payload array.

Each hash contains the current and state returns.

current

string

The SPF record's contents.

This function returns this value in the records array.

A valid string.
v=spf1 +a +mx ip6:0:0:0:0:0:ffff:c0a8:101 ~all

state

string

The SPF record's status.

Note
titleNote:

These values correspond with RFC7208 section 2.6.

This function returns this value in the records array.

  • PASS — The SPF record confirms that the ip_address value is a valid sender.
  • NEUTRAL — The current SPF record configuration does not determine the ip_address value's validity.
  • FAIL — The SPF record states that the ip_address value is not a valid sender.
  • SOFTFAIL — The SPF record states that the ip_address value is not a valid sender, but does not FAIL state it.
  • TEMPERROR — The SPF record check resulted in a failure. For example, a network failure.
  • PERMERROR — The domain's SPF records are incorrect and require manual correction.
PASS