To generate DKIM key in Zimbra Mail server, login as user zimbra
su - zimbra
Now run
/opt/zimbra/libexec/zmdkimkeyutil -a -d DOMAIN_NAME
Example
zimbra@mail:~$ /opt/zimbra/libexec/zmdkimkeyutil -a -d serverok.in
DKIM Data added to LDAP for domain serverok.in with selector 1F6B0E4C-3AA1-11E8-9B49-B0D65E0AC318
Public signature to enter into DNS:
1F6B0E4C-3AA1-11E8-9B49-B0D65E0AC318._domainkey IN TXT ( "v=DKIM1; k=rsa; "
"p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA354ZukWI34mIZKFM/IsKnUO6fnwhF8PLpgb2NOl687yzlxk1HYwlM7lyS9T4blAWlbOEzkdT1lLpNJRzEImrlkFzmzXaBWPSMEoJQVQgTfir6OoXoCUtwuLmPqwEftb2Th+/9Wmkh3PTc3o+x7/4kV0QMCTnJVXIFSHAfNREG8mGNPgij/iXHwbpVEi2P0UzmI/882TCEJXBry"
"nKB4g5HtiOx1WUNtsKTEAyA9/5vZqsqa1RupHLOxwqyrTcNA9IL/iadOG3Q4PCXN788pQNCzpCyUQn6OQwFDy7/S345NGygd51F93NIZGmj01qWYq8VpFiNKnAOWTX9UiW27hA/QIDAQAB" ) ; ----- DKIM key 1F6B0E4C-3AA1-11E8-9B49-B0D65E0AC318 for serverok.in
zimbra@mail:~$
Retrieve the DKIM Key
Use the following command to display the DKIM key for the specified domain.
/opt/zimbra/libexec/zmdkimkeyutil -q -d YOUR_DOMAIN_HERE