DKIM: sign your email
DKIM (DomainKeys Identified Mail) puts a cryptographic signature in the header of every message you send. The receiver fetches your public key from DNS and checks the signature. If it matches, the message was not altered, and it really came from your domain.
How it works
- Your mail server signs each outgoing message with a private key that only it holds.
- The signature goes in a
DKIM-Signatureheader. - The header names a selector and your domain, such as
defaultandexample.ca. - The receiving server looks up the public key at
default._domainkey.example.ca. - It checks the signature against the key. Match means
dkim=pass.
The DNS record
A TXT record at <selector>._domainkey.<domain>.
default._domainkey.example.ca. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
| Tag | Meaning |
|---|---|
v=DKIM1 |
Version. Required. |
k=rsa |
Key type. RSA is standard. |
p= |
The public key, in Base64. If empty, the key is revoked. |
t=y |
Optional. Marks the domain as testing. Remove once live. |
s=email |
Optional. Limits use to email. |
h=sha256 |
Optional. Allowed hash algorithm. |
The record name part default is the selector. A domain can have many selectors, one per sending service.
The signature header
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.ca;
s=default; t=1764500000; h=from:to:subject:date:message-id;
bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=;
b=dzdVyOfAKCdLXdJOc9G2q8LoXSlEniSbav+yuU4zGeeruD00lszZVoG4ZHRNiYzR
| Tag | Meaning |
|---|---|
a= |
Signing algorithm |
c= |
How the message is normalized before signing |
d= |
The signing domain. This is the one DMARC compares to the From address. |
s= |
The selector |
h= |
Which headers were signed |
bh= |
Hash of the body |
b= |
The signature |
Multiple services, multiple selectors
Each service that sends for you should sign with its own selector.
| Service | Typical selector |
|---|---|
| Barbrick mailboxes | default |
| Microsoft 365 | selector1, selector2 |
| Google Workspace | google |
| Newsletter tools | Given by the tool |
Turn it on at Barbrick
Account → Hosting → your site → Email → Deliverability shows whether DKIM is valid for each domain. If you use Barbrick's nameservers, we manage the record for you. See Check your setup with Deliverability and Set up SPF, DKIM, and DMARC.
Check it
dig +short TXT default._domainkey.example.ca
"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."
Send a message to a Gmail address, open it, choose Show original, and look for DKIM: PASS.
Key length
Use a 2048-bit key. 1024-bit keys are outdated. The record may be longer than 255 characters, so it is stored in chunks. The DNS page does this for you.
If something goes wrong
dkim=none. The mail was not signed. Turn on DKIM and send again.dkim=fail (body hash did not verify). Something modified the message after signing, such as a mailing list or a footer added by a gateway.dkim=neutral (key not found). The DNS record is wrong or missing. Check the selector name.- Outside DNS. If DNS is not at Barbrick, copy the TXT value into your DNS provider. See Keep DNS somewhere else.
Still stuck? Ask us and we'll walk you through it.