SystemMen - Fix DKIM field must be base64 encoded. In this article, I will show you how to fix this error of DKIM.
If you have read the article How to check a DKIM core key record is correct that I wrote earlier. You will probably encounter the following error.
What the error looks like
This error occurs when you proceed to check if the content of the DKIM record is correct. But what is it? Why did it appear?
Look at the image below to imagine what the error looks like.
In the demo, I used the DKIM record content as below.
v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDX+uU4eJQPmmtfbN1XeeGYnYPb\ncH8lr3Hot6y0lKfNlekUvLKl9a9DHvw2Sv2sVC/2FjrFdPhlsZb8QzbLWbNOZDNB\nKoVJmixcsqjcZrTD4Ym+VcbiN5hcUqWMHOwH+1RVmMMc+/5YbKJm2RBMynAGr2hU\n4yxkz1XhK8mt1WlXFwIDAQAB
Looks very normal right. But why does it fail?
Fix DKIM field must be base64 encoded
If you take a closer look or when you have configured DKIM many times, you will realize it.
DKIM record does not contain spaces, double quotes, or line breaks.
In programming, the line break character is \n
. Take a look at the content below that I marked.
p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDX+uU4eJQPmmtfbN1XeeGYnYPb\n
cH8lr3Hot6y0lKfNlekUvLKl9a9DHvw2Sv2sVC/2FjrFdPhlsZb8QzbLWbNOZDNB\n
KoVJmixcsqjcZrTD4Ym+VcbiN5hcUqWMHOwH+1RVmMMc+/5YbKJm2RBMynAGr2hU\n
4yxkz1XhK8mt1WlXFwIDAQAB
I marked 3 times the character \n
in the content of the DKIM record.
After removing those characters, the error has been fixed.
Conclusion
Just a little note, but it is very important to configure DKIM. For those who are just beginning to administer the email system, hopefully this article will help you.
«« How to check a DKIM core key record is correctHow to extend Linux LVM partition in AWS »»