Set DKIM record for hostedemail domains using API

Short link: opensrs.help/dkim-api

This article explains how to add DKIM record to hostedemail domains using API rather than adding the private key and selector manually using the Mail admin interface.

1. Generate DKIM public key, private key, and key selector
2. Add public key as a TXT record on the domain
3. Add the private key and selector information for the domain using API

1. Generate DKIM public key, private key, and key selector

First, you need to generate a public key, private key, and domain key selector to add the DKIM record on a hostedemail domain. You may use online tools like port25 DKIM wizard. Enter the domain name, domain key selector, and the key size.

Note: If you are using the default systemDNS nameservers, please generate the key in 1024 bits, not 2048 bits.  

DKIM.png

Back to top

2. Add public key as a TXT record on the domain

Once the DKIM key is created, the next step is to add the public key as a TXT record on the DNS zone of the domain name. The TXT record needs to be added on a subdomain based on the selector that you choose. For the above example, add the TXT record on key1._domainkey.dkimtesting.com. If the domain is registered with OpenSRS, you can use set_dns_zone to add the TXT record to the domain.

3. Add the private key and selector information for the domain using API 

The change_domain method can be used to add the DKIM record to an existing email domain.

dkim_selector A selector generated with your private DKIM record.
This is required if attribute dkim_key is specified.
dkim_key

Your private DKIM key generated with your selector.
This is required if attribute dkim_selector is specified.

Note: Every line break in the DKIM key must be denoted with newline control character '\n'

Sample request

{ 
"attributes":{
"dkim_selector":"key1",
"dkim_key":"BEGIN RSA PRIVATE KEY/END RSA PRIVATE KEY"
},
"credentials":{
"user":"user@domain.adm",
"password":"AubE8bHbhx4"
},
"domain":"dkimtesting.com"
}
Response
{
"success": true,
"audit": "snake40_5dcdd78e14"
}

Back to top

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.