Introduction
Most email providers require your domain to contain a DKIM record. The DKIM record can be obtained from the UAPI or WHMAPI.
Procedure
API calls:
UAPI: https://api.docs.cpanel.net/openapi/cpanel/operation/validate_current_dkims/.
WHMAPI: https://api.docs.cpanel.net/openapi/whm/operation/validate_current_dkims/.
DKIM:
When executing both the UAPI and WHMAPI call, it will validate the current installed DKIM DNS record and return the suggested DKIM record, which can be observed via the interface as well.
UAPI:
# uapi --user=example EmailAuth validate_current_dkims domain='example.com'
---
apiversion: 3
func: validate_current_dkims
module: EmailAuth
result:
data:
-
domain: default._domainkey.example.com
error: ~
expected: v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA20kR9ecUc6WkjA+1L7Q/NISQ2i4dIQzkxlYaWmhRWG7pVh4cHTIgirery97VdNceP0ww6Fch7dLQjtEEu5qMy9BEMEJg/3dd0G4BHZALjjIK/ujgUtQsAxifgwIH96BJdo0cgobzsWNd93dTkcH1PyFnvVo1Qw0WKMnzCEhq8FGYYLthzCESVX5g2YJLf2lAUgetrexhQdKZ0Aq2JiMw0/EpIRSEAbYoFpEp41HF6aCUoDnkisQ1bnihi3c94F7DoyNntgYviHeJ0e3F/AlcBEnfBf++E0zwCcNI0QarRH0EsvjT16tgFRAXxKzRN9TPsSBnZeW51yMBnGCvrwLitQIDAQAB;
records: []
state: MISSING
validity_cache_update: none
errors: ~
messages: ~
metadata:
transformed: 1
status: 1
warnings: ~
WHMAPI:
# whmapi1 validate_current_dkims domain='example.com'
---
data:
payload:
-
domain: default._domainkey.example.com
error: ~
expected: v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA20kR9ecUc6WkjA+1L7Q/NISQ2i4dIQzkxlYaWmhRWG7pVh4cHTIgirery97VdNceP0ww6Fch7dLQjtEEu5qMy9BEMEJg/3dd0G4BHZALjjIK/ujgUtQsAxifgwIH96BJdo0cgobzsWNd93dTkcH1PyFnvVo1Qw0WKMnzCEhq8FGYYLthzCESVX5g2YJLf2lAUgetrexhQdKZ0Aq2JiMw0/EpIRSEAbYoFpEp41HF6aCUoDnkisQ1bnihi3c94F7DoyNntgYviHeJ0e3F/AlcBEnfBf++E0zwCcNI0QarRH0EsvjT16tgFRAXxKzRN9TPsSBnZeW51yMBnGCvrwLitQIDAQAB;
records: []
state: MISSING
validity_cache_update: none
metadata:
command: validate_current_dkims
reason: OK
result: 1
version: 1
To obtain only the DKIM record, you can run the following within the command line (you only need to replace the domain):
UAPI:
uapi --user=example EmailAuth validate_current_dkims domain='example.com' | grep expected | cut -c 17-
WHMAPI:
whmapi1 validate_current_dkims domain='example.com' | grep expected | cut -c 17-
Output:
v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA20kR9ecUc6WkjA+1L7Q/NISQ2i4dIQzkxlYaWmhRWG7pVh4cHTIgirery97VdNceP0ww6Fch7dLQjtEEu5qMy9BEMEJg/3dd0G4BHZALjjIK/ujgUtQsAxifgwIH96BJdo0cgobzsWNd93dTkcH1PyFnvVo1Qw0WKMnzCEhq8FGYYLthzCESVX5g2YJLf2lAUgetrexhQdKZ0Aq2JiMw0/EpIRSEAbYoFpEp41HF6aCUoDnkisQ1bnihi3c94F7DoyNntgYviHeJ0e3F/AlcBEnfBf++E0zwCcNI0QarRH0EsvjT16tgFRAXxKzRN9TPsSBnZeW51yMBnGCvrwLitQIDAQAB;
For more information regarding the APIs, please read the following documentation: https://api.docs.cpanel.net/.
Comments
0 comments
Article is closed for comments.