Fix DKIM field must be base64 encoded

by Daniel Pham
Published: Updated:

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.

fix dkim field must be base64 encoded
Fix DKIM field must be base64 encoded.

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.


I marked 3 times the character \n in the content of the DKIM record.

After removing those characters, the error has been fixed.


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.

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.