Child pages
  • UAPI Functions - EmailAuth::install_spf_records

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 a domain on the DNS server.

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
titlecPanel or Webmail Session URL


Code Block
languagetext
https://hostname.example.com:2083/cpsess##########/execute/EmailAuth/install_spf_records?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

Include Page
LIB:_CallUAPIFromBrowserLink
LIB:_CallUAPIFromBrowserLink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Install an SPF record for a domain on the DNS server.
$poll = $cpanel->uapi(
    'EmailAuth', 'install_spf_records',
    array(
        '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'
  )
);

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Install an SPF record for a domain on the DNS server.
my $poll = $cpliveapi->uapi(
    'EmailAuth', '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'
  }
);

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Template Toolkit


Code Block
languagexml
linenumberstrue
<!-- Install an SPF record for a domain on the DNS server. -->
[% execute( 'EmailAuth', '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'
	}
) %]

Include Page
LIB:_TTLink
LIB:_TTLink


Expand
titleCommand Line


Code Block
languagebash
uapi --user=username EmailAuth 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"

Include Page
LIB:_UAPICLINote
LIB:_UAPICLINote


Expand
titleOutput (JSON)


Code Block
languagebash
linenumberstrue
{
   "apiversion": 3,
   "module": "EmailAuth",
   "func": "install_spf_records",
   "result": {
      "data": [
        {
            "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": "[REPLACE:TXT@anotherexample.com.:v=spf1 ip4:10.0.0.1 %2Ba %2Bmx %2Bip4:10.0.0.2 %2Bip4:10.0.0.3 -all]",
			"status": 1
		}
    ],
    "errors": null,
    "messages": null,
    "metadata": {
        "transformed": 1
            },
    "status": 1,
    "warnings": null
    }
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

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

Note
titleNote:

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.

Note
titleNote:

You must provide this parameter for each 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
dataarray 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 data 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 data array.

A valid string.



Expand
titleClick to view...
[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 data 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