# Setting Up DKIM Authentication

Add DKIM DNS records so receiving servers can verify your emails are authentic.

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to every email you send. The receiving server uses your published public key to verify the signature, confirming the email was not tampered with in transit.

### How It Works

Mailnaptic signs outgoing emails with a private key. The corresponding public key is published as a DNS record on your domain. When a recipient’s mail server receives your email, it looks up the DKIM record, retrieves the public key, and checks the signature.

### Adding the DKIM Record

1. Go to **Domains → Sending domains** and click on your domain to open its page.
2. In the DNS records list, find the **TXT** record whose host contains `._domainkey`. It looks similar to: 
 ```
 mail._domainkey.example.com TXT v=DKIM1; k=rsa; p=<public key>
 ``` The selector (the part before `._domainkey`) and the key are shown on the page; copy them exactly.
3. Log in to your DNS provider and create the TXT record exactly as shown.
4. Return to Mailnaptic and click **Check DNS**.

### Troubleshooting

- **Record not found** — Double-check the host name. It must include `._domainkey`. Some DNS providers append your domain automatically, so you may need to enter only the part before the domain.
- **Key mismatch** — The value of `p=` must match the key shown in Mailnaptic exactly. A truncated or re-wrapped key will not verify. Long values may be split into several quoted strings by your DNS provider; that is fine.
- **Propagation delay** — TXT records typically propagate within 5–15 minutes but can take up to 48 hours with some providers.

> **Important:**
> 
> DMARC passes when SPF or DKIM passes and aligns with your From domain, so set up both before configuring your DMARC policy.
