DKIM, SPF and DMARC: email deliverability basics, done for you
SPF, DKIM, and DMARC are three DNS-based email authentication records that prove your messages are genuine and keep them out of the spam folder.
On this page 7 sections
SPF, DKIM, and DMARC are three complementary email authentication methods configured in your DNS to prove you own your domain and prevent spoofing. Sender Policy Framework (SPF) lists which servers can send on your behalf, DomainKeys Identified Mail (DKIM) adds a cryptographic signature to verify message contents were not altered, and Domain-based Message Authentication, Reporting, and Conformance (DMARC) tells receiving servers what to do when SPF or DKIM fails. Setting up all three records correctly ensures mailbox providers deliver your transactional and marketing messages to the primary inbox.
When you send email from an application, receiving mail servers inspect these records before accepting your message. If authentication fails or records are missing, servers mark messages as spam or drop them outright.
What SPF, DKIM, and DMARC actually do
Each of the three protocols answers a different verification question for receiving mail servers.
SPF: Who can send?
SPF is published as a DNS TXT record on your domain. It declares which mail servers or IP addresses are authorized to send messages using your domain in the envelope sender address (the bounce address). When a recipient server receives an incoming connection, it checks whether the sender's IP address matches an entry in your SPF record. If it matches, SPF passes.
DKIM: Was the message altered in transit?
DKIM uses public-key cryptography. When an email server sends your message, it creates a digital signature across specific email headers and the body using a private key. It inserts this signature into the message headers. Recipient servers retrieve your public key from a DNS CNAME or TXT record at a specific selector (such as <token>._domainkey.yourcompany.com) and verify the signature. If the signature matches, the server knows the message genuinely came from you and nobody modified the contents in transit.
DMARC: What should the receiver do when checks fail?
DMARC sits on top of SPF and DKIM as a DNS TXT record at _dmarc.yourcompany.com. It requires "alignment," meaning the visible From domain matches the domain authenticated by SPF or DKIM. DMARC tells receiving providers what policy (p=) to apply if an email fails both SPF and DKIM:
p=none: Monitor only. The receiving server delivers the email normally and sends aggregate reports back to you.p=quarantine: Send failing mail to the recipient's spam or junk folder.p=reject: Block failing mail completely at the gateway.
The exact DNS records needed for custom domain email
When you manage your own domain, configuring custom sending addresses like hello@sellshelf.app requires publishing specific records with your DNS provider.
In thelastapi, adding a mailbox via the console or CLI reveals the exact records you need to verify:
vibiz email mailbox add hello@sellshelf.app --name "Sell Shelf"
vibiz email dns sellshelf.app --checkThese records handle authentication, inbound routing, and bounce processing:
| Purpose | Record type | Host name | What it does |
|---|---|---|---|
| Receive | MX | @ | Routes incoming mail to your mailbox |
| DKIM | CNAME ×3 | <token>._domainkey | Signs outbound messages and proves domain ownership |
| Bounce MX | MX | bounce | Routes return-path delivery failure notices |
| SPF | TXT | bounce | v=spf1 …: authorizes sending for bounce.yourcompany.com so SPF and DMARC line up |
| DMARC | TXT | _dmarc | v=DMARC1; p=none; sets the fallback policy if no DMARC record exists |
Because SPF validates the return-path (bounce.yourcompany.com) rather than cluttering your apex domain's SPF record, you avoid hitting DNS lookup limits while keeping SPF and DMARC aligned.
Sending email without configuring DNS manually
Configuring DNS records takes time and introduces room for error. If you need to send notifications or transactional alerts immediately, you do not have to touch DNS records at all.
When you add the email resource to a project, thelastapi assigns an address on a verified subdomain: <slug>.vibiz.app.
vibiz init mailer --resources emailEvery project domain comes with SPF, DKIM, and DMARC already aligned. The sending address defaults to info@<slug>.vibiz.app.
You can send an email right from your terminal:
vibiz send --to ana@example.com --subject "Welcome" --text "Hi Ana" --from helloOr from your server-side application using @vibiz/app on your VIBIZ_APP_KEY:
import { vibiz } from '@vibiz/app';
await vibiz.email.send({
to: 'ana@example.com',
subject: 'Your order is ready',
text: 'Pick it up any time today.',
from: 'orders', // sends as orders@acme-bakery.vibiz.app
reply_to: 'owner@example.com',
});Because inbound delivery on the <slug>.vibiz.app address is not active yet, set reply_to to an existing inbox where you can answer customer replies. To learn more about sending right away, see our guide on how to send transactional email from your app without touching DNS.
If you purchase a domain directly using vibiz domains buy sellshelf.app, every MX, CNAME, and TXT record is written to DNS automatically without manual copying and pasting.
How to check and verify your records
If you host your domain DNS with a third-party registrar, you must verify that the records you entered match what the system expects.
Check your status with the CLI:
vibiz email dns sellshelf.app --checkEach record is reported as Found, Missing, or Different value. You can also inspect records over HTTP:
curl https://thelastapi.dev/v1/inbox/domains/sellshelf.app \
-H "Authorization: Bearer $VIBIZ_API_KEY"To re-check records after making updates in your DNS manager, trigger a lookup:
curl -X POST https://thelastapi.dev/v1/inbox/domains/sellshelf.app/verify \
-H "Authorization: Bearer $VIBIZ_API_KEY"Domain verification typically completes within minutes. If your application sends before verification succeeds, the API returns a 409 dependency_not_ready error with sender_not_ready. Once every record passes inspection, the domain status changes to verified.
What happens when authentication fails
When SPF, DKIM, or DMARC are missing or misconfigured, major email providers protect their users by filtering your messages into spam or blocking them at the edge.
Beyond DNS validation, maintaining your sender reputation requires keeping deliverability metrics clean:
- Transactional limits: To prevent unauthorized abuse, project sending starts at 50 emails per UTC day across all mailboxes. You can read more about why this limit exists in our breakdown of email sending limits.
- Bounces and complaints: If too many messages bounce or recipients flag your messages as junk, sending is paused automatically (
403 sending_paused). - Marketing separation: To protect your transactional delivery, newsletters and broadcast campaigns send from a separate subdomain (such as
hello@news.<slug>.vibiz.appornews.yourcompany.com). If a marketing blast experiences hard bounces exceeding 2.5% or spam complaints exceeding 0.08%, that broadcast pauses automatically (paused_reason: bounces | complaints). Because marketing is isolated, your app's transactional password resets continue sending without interruption.
For newsletters and bulk messaging, always respect user consent and provide clear unsubscribe paths. Review the rules in double opt-in and unsubscribe links to stay compliant with CAN-SPAM and major provider rules.
Next steps
To set up an authenticated sending domain, add the email resource using the CLI or configure a custom mailbox under your project settings. For full API details on message sending, inbound routing, and DNS verification routes, visit the Email documentation.
Frequently asked questions
Do I need a custom domain to send emails with valid SPF, DKIM, and DMARC?
No. Adding the `email` resource gives your project an address at `<slug>.vibiz.app` that has SPF, DKIM, and DMARC aligned and verified by default.
How many DNS records do I need to add for a custom domain?
For an external domain, you add six records: an MX record for receiving, three CNAME records for DKIM, one MX and one TXT record on the bounce subdomain for bounce handling and SPF, and a recommended TXT record for DMARC.
What happens if an email fails both SPF and DKIM?
The receiving provider inspects your domain's DMARC policy: if set to `p=none` the message is delivered, if set to `p=quarantine` it goes to spam, and if set to `p=reject` it is dropped entirely.
Why is SPF configured on a "bounce" subdomain instead of the root domain?
Placing SPF on `bounce.yourcompany.com` validates the return-path envelope address without modifying or risking DNS lookup limit overruns on your root domain's existing SPF record.