Child pages
  • UAPI Functions - EmailAuth::enable_dkim
Skip to end of metadata
Go to start of metadata

Description

This function enables Domain Keys Identified Mail (DKIM) records on the DNS server for one or more domains.

Important:

When you disable the MailSend role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/EmailAuth/enable_dkim?domain=example.com&domain=anotherexample.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Enable a DKIM record for a domain.
$poll = $cpanel->uapi(
    'EmailAuth', 'enable_dkim',
    array(
        'domain' => 'example.com',
		'domain' => 'anotherexample.com'
  )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Enable a DKIM record for a domain.
my $poll = $cpliveapi->uapi(
    'EmailAuth', 'enable_dkim',
    {
        'domain' => 'example.com'
		'domain' => 'anotherexample.com'
  }
);


Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Enable a DKIM record for a domain. -->
[% data = execute('EmailAuth', 'enable_dkim', { 'domain' => 'example.com', 'domain' => 'anotherexample.com' } ) %]
[% FOREACH q = data.enable_dkim %]
     <p>
         [% q %]
     </p>
[% END %]


Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username EmailAuth enable_dkim domain=example.com domain=anotherexample.com


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
   "apiversion": 3,
   "module": "EmailAuth",
   "func": "enable_dkim",
   "result": {
      "data": [
        {
            "domain": "example.com",
            "msg": "Installed Keys",
            "status": 1
        },
		{
			"domain": "anotherexample.com",
			"msg": "[no changes needed]",
			"status": 1
		}
    ],
  "errors": null,
  "messages": null,
  "metadata": {
      "transformed": 1
          },
  "status": 1,
  "warnings": null
  }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain for which to enable DKIM records on the DNS server.

Note:

To enable multiple domain DKIM 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

Returns

ReturnTypeDescriptionPossible valuesExample
dataarray of hashes

An array that contains information about the enabled state of a domain's DKIM records on the DNS server.

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

                

domain

string

The domain for which the system enabled the DKIM record.

This function returns this value in the data array.

A valid domain.

example.com

msg

string

The domain's DKIM record status message.

This function returns this value in the data array.

A valid string.Installed Keys

status

Boolean

Whether the system enabled the domain's DKIM record on the DNS server.

This function returns this value in the data array.

  • 1The system enabled the domain's DKIM record.
  • 0 — The system did not enable the domain's DKIM record.
1